Tuesday, May 6, 2008

PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE

The other day one of our developers decided to create some code that he wanted to be accessible from SQL Server 2005 Stored Proc. While he was on vacation, we deployed the application on the client's server for UAT and got the following message:

"Executed as user: xxx\SVCSQLAGENT. An error occurred in the Microsoft .NET Framework while trying to load assembly id 65545. 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…"

After digging around a little bit, I delegated the problem to one of my colleagues (Jos) who solved the problem promptly. Below is the solution:


ALTER DATABASE MY_DATABASE
SET TRUSTWORTHY ON;
go

USE MY_DATABASE
go
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

7 comments:

Anonymous said...

Perfect solution - worked in SQL2008

Anonymous said...

Lifesaver!!! tyvm

Anonymous said...

Thank you! You just saved me who knows how much time tracking this down... :D

Anonymous said...

Another random thank you... was testing out an SSIS package after coworker restored a DB.

Anonymous said...

It works, thanks!

HungryTom said...

Hi,

I found that the solution to this problem for me was that the owner was non-existent on the machine...

See this article: http://support.microsoft.com/kb/918040

I solved it with the following code:

ALTER DATABASE database_name SET TRUSTWORTHY ON;

GO

EXEC sp_changedbowner 'sa'

GO

Anonymous said...

thanks... worked 5*..

my thanks !