开发者

Sql CLR runtime error

Doing a SQL CLR. Everything worked great in development, everything whent great in testing, then we went live, and everything broke. So it seems to have something to do with EXTERNAL_ACCESS security. I have confirmed that our database is marked as trustworthy, the database owner is a sysadmin, and the assembly is marked as EXTERNAL_ACCESS permissions. That leaves me a bit stumpted as to what could cause this error. Any other ideas on what could cause this error?

(I hid a few things that arnt critical to the error)

Error querying repository for dirty items: 'prc_XXXXXXXXXXXXXXXXXXXXX' System.Data.SqlClient.SqlException: 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 'myassemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123451234151234' or one of its dependencies. Exception from HRESULT: 0x80FC3C2C 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) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader开发者_运维知识库.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at ....


For some reason, even though the UI showed that the assembly had external access permissions (and it added to the database with those permissions), internally it must have thought that it didnt have that kind of access for some reason. So as a work around I ran these commands and it fixed the problem (note I tried running just the second command, and it didnt fix it):

ALTER ASSEMBLY [< AssemblyName>] WITH PERMISSION_SET = UNSAFE

ALTER ASSEMBLY [< AssemblyName>] WITH PERMISSION_SET = EXTERNAL_ACCESS

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜