Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileLoadException / Msg 10314 Error Running CLR Stored Procedure

Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.

Msg 10314, Level 16, State 11, Line 1 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. 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 'orders, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' 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.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) 
like image 668
homeskillet Avatar asked Sep 16 '08 13:09

homeskillet


2 Answers

Ran the SQL commands below and the issue appears to be resolved.

USE database_name GO  EXEC sp_changedbowner 'sa' ALTER DATABASE database_name SET TRUSTWORTHY ON  
like image 82
homeskillet Avatar answered Sep 28 '22 05:09

homeskillet


Build your project with ANY CPU configuration. I had this problem when compiled my own project with x86 configuration and tried to run it on x64 SQL server.

like image 42
nuwanda Avatar answered Sep 28 '22 05:09

nuwanda