CLR 저장 프로 시저를 실행하려고 할 때 다음 오류를 수신합니다. 어떤 도움이라도 대단히 감사합니다.
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)
아래 SQL 명령을 실행하면 문제가 해결 된 것 같습니다.
USE database_name
GO
EXEC sp_changedbowner 'sa'
ALTER DATABASE database_name SET TRUSTWORTHY ON
모든 CPU 구성으로 프로젝트를 빌드하십시오. x86 구성으로 내 프로젝트를 컴파일하고 x64 SQL 서버에서 실행하려고 할 때이 문제가 발생했습니다.
위의 제안을 모두 적용했지만 실패했습니다. 그런 다음 "Any CPU"옵션을 사용하여 소스 코드를 다시 컴파일했습니다.
이 링크는 도움이되었습니다 . SQL Server가 PERMISSION으로 어셈블리를로드하지 못했습니다.
ALTER AUTHORIZATION ON DATABASE::mydb TO sa;
ALTER DATABASE [myDB] SET TRUSTWORTHY ON
GO
어셈블리가 파일 I/O를 수행합니까? 그렇다면 어셈블리 권한을 부여해야합니다. SSMS에서 :