January 19, 2007 at 8:46 am
hi.
Im trying to read the size of a file from a sproc, so i created a clr stored proc using c#. when i try to deploy it i get this error:
CREATE ASSEMBLY for assembly 'FileInfo' failed because assembly 'FileInfo' is not authorized for PERMISSION_SET = EXTERNAL_ACCESS. The assembly is authorized when either of the following is true: the database owner (DBO) has EXTERNAL ACCESS ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission.
Can someone tell me what to do here?
January 19, 2007 at 10:38 am
any assembly implementing a CLR sproc that reads from the file system must be created with the EXTERNAL_ACCESS keyword. and as the error msg says, you can only create EXTERNAL_ACCESS assemblies in databases that have their trustworthy bit set to on, or you sign the assembly with a certificate or key associated with a login that has the EXTERNAL ACCESS ASSEMBLY permission.
the trustworthy bit tells sql server that it should "trust" the assemblies in a given database. Such assemblies are allowed to access system resources outside of sql server (such as the file system). If you are using assemblies from a third party, think carefully before you turn the trustworthy bit on. Better would be to use only SAFE assemblies from third parties. If you wrote the code yourself, make sure you aren't doing anything silly in the assembly.
There's lots more info on this in BOL:
http://msdn2.microsoft.com/en-us/library/ms189524.aspx
http://msdn2.microsoft.com/en-us/library/ms403273.aspx
about the trustworthy bit:
http://msdn2.microsoft.com/en-us/library/ms176061.aspx
http://msdn2.microsoft.com/en-US/library/ms174269.aspx
---------------------------------------
elsasoft.org
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply