web-development-kb-es.site

FileLoadException / Msg 10314 Error al ejecutar el procedimiento almacenado CLR

Recibiendo el siguiente error al intentar ejecutar un proceso almacenado CLR. Cualquier ayuda es muy apreciada.

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)
34
homeskillet

Ejecutó los comandos SQL a continuación y el problema parece estar resuelto.

USE database_name
GO

EXEC sp_changedbowner 'sa'
ALTER DATABASE database_name SET TRUSTWORTHY ON 
69
homeskillet

Construya su proyecto con CUALQUIER configuración de CPU. Tuve este problema cuando compilé mi propio proyecto con la configuración x86 e intenté ejecutarlo en el servidor x64 SQL.

8
nuwanda

Aplicamos toda la sugerencia anterior y falló. Luego volví a compilar mi código fuente con la opción "Cualquier CPU", ¡y funcionó!

Este enlace ayudó: SQL Server no pudo cargar el ensamblado con PERMISO

2
101V
ALTER AUTHORIZATION ON DATABASE::mydb TO sa;
ALTER DATABASE [myDB] SET TRUSTWORTHY ON
GO
0
Musakkhir Sayyed

¿Su Asamblea archiva E/S? Si es así, debe otorgar permiso a la Asamblea para hacer esto. En SSMS:

  1. Expandir "Bases de datos"
  2. Expanda el nodo para su base de datos
  3. Expandir "Programabilidad"
  4. Expandir "Ensamblados"
  5. Haga clic derecho en su ensamblaje, elija Propiedades
  6. En la página "General", cambie "Conjunto de permisos" a "Acceso externo"
0
Craig Stuntz