服務端執行部署好的CLR儲存過程時出現如下異常

Insus.NET發表於2021-08-25

 

訊息 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

 

相關文章