FileLoadException / Msg 10314 Error Running CLR Stored Procedure

后端 未结 5 682
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-08 09:56

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         


        
相关标签:
5条回答
  • 2020-12-08 10:07
    ALTER AUTHORIZATION ON DATABASE::mydb TO sa;
    ALTER DATABASE [myDB] SET TRUSTWORTHY ON
    GO
    
    0 讨论(0)
  • 2020-12-08 10:11

    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.

    0 讨论(0)
  • 2020-12-08 10:17

    Applied all of the above suggestion and it failed. Then I recompiled my source code with "Any CPU" option, and it worked!

    This link helped: SQL Server failed to load assembly with PERMISSION

    0 讨论(0)
  • 2020-12-08 10:25

    Does your assembly do file I/O? If so, you must grant the assembly permission to do this. In SSMS:

    1. Expand "Databases"
    2. Expand the node for your database
    3. Expand "Programmability"
    4. Expand "Assemblies"
    5. Right-click your assembly, choose Properties
    6. On the "General" page, change "Permission set" to "External access"
    0 讨论(0)
  • 2020-12-08 10:33

    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 
    
    0 讨论(0)
提交回复
热议问题