服务端执行部署好的CLR存储过程时出现如下异常
消息 10314,级别 16,状态 11,第 44 行
在尝试加载程序集 ID 65545 时 Microsoft .NET Framework 出错。服务器可能资源不足,或者不信任该程序集。请重新运行查询,或检查有关的文档了解如何解决程序集信任问题。有关此错误的详细信息:
System.IO.FileLoadException: 未能加载文件或程序集“etdgdddatabase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。发生与安全有关的错误。 (异常来自 HRESULT:0x8013150A)
System.IO.FileLoadException:
在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Reflection.Assembly.Load(String assemblyString)
解决方法:
sp_configure 'clr enabled', 1 GO RECONFIGURE GO ALTER DATABASE [database name] SET TRUSTWORTHY ON GO