.net - System.Security.HostProtectionException when Executing User Defined Function on SQL Server -
i wrote user defined function gets utctimestamp , windowstimezoneid parameters , returns timestamp timezone.
but if want execute in simple select following error:
a .net framework error occurred during execution of user-defined routine or aggregate "tolocaltime": system.security.hostprotectionexception: attempted perform operation forbidden clr host. protected resources (only available full trust) were: demanded resources were: mayleakonabort system.security.hostprotectionexception: bei timefunctions.tolocaltime(datetime utctimestamp, string windowstimezoneid) i execute select sa. set clr enabled 1. use sql server 2008 r2 (10.50.1600).
does know have set working or may done wrong?
clr assemblies have trust levels.
this 1 requires unsafe permissions because of rights required use "mayleakonabort"
either change clr safer, or re-add assembly unsafe rights. word "unsafe" of course...
Comments
Post a Comment