The server may be running out of resources in aggregate functiond

0

I try to copy this code and to deploy this function to my server. When I try to create the function I get the message below. It's very strange to me because I don't use any unsafe resource.

I tried to run this with execute as 'dbo', and it's not helped me. I also tried to set AUTHORIZATION to ON.

An error occurred in the Microsoft .NET Framework while trying to load assembly id 65958. 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 'exampleaggfunction, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) System.IO.FileLoadException:

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)

at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

c#
sql-server-2012
sqlclr
asked on Stack Overflow Jun 11, 2013 by David Weinberg • edited Jun 11, 2013 by oleksii

1 Answer

1

I have solved same problem.

Look's for solution here: http://blogs.msdn.com/b/psssql/archive/2010/03/23/unable-to-load-clr-assembly-intermittently.aspx

  1. Change the database's owner to sa which is gauranteed to match.

    USE your_db_name; ALTER AUTHORIZATION ON DATABASE::your_db_name TO SA; GO

  2. Ensure that the db_owner's SID on from every database matches sys.server_principals and sys.databases: SELECT * FROM [master].[sys].[server_principals] -- here are SID of users

    SELECT * FROM [master].[sys].[databases] -- here information about databases

It helped me. May be it will be useful for you.

answered on Stack Overflow Jan 14, 2014 by aperfilyev

User contributions licensed under CC BY-SA 3.0