I'm getting the following error when trying to execute a stored procedure which calls a .net assembly deployed within a SQL 2005 database:
Msg 50000, Level 16, State 1, Procedure usp_GetPrintFilePathandExecPrintJob, Line 63
Error (10314) has occured while executing the usp_GetPrintFilePathandExecPrintJob method. Reason: An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'quantumprintfile, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b50734a63ac65c10' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A)
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
The assembly was added using:
CREATE ASSEMBLY [QuantumPrint]
AUTHORIZATION [dbo]
FROM ...
WITH PERMISSION_SET = EXTERNAL_ACCESS
I can not understand why I am getting the above error.
Eventually found the solution through a long winded MSDN article. The login we were using did not have 'EXTERNAL ACCESS ASSEMBLY'. The issue was corrected by running the following:
USE Master GRANT EXTERNAL ACCESS ASSEMBLY TO
Does the SQL server user have permission to execute the file?
User contributions licensed under CC BY-SA 3.0