Feb 12, 2012

CREATE ASSEMBLY for assembly '' failed because assembly '' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.


When we will create Assembly in sql sever we may get error message like this:

CREATE ASSEMBLY for assembly '' failed because assembly '' is not authorized for PERMISSION_SET = UNSAFE.  The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.

Solution:

Execute following sql statement in your database

ALTER DATABASE DemoDB SET TRUSTWORTHY ON
EXEC dbo.sp_changedbowner @loginame = N'sa', @map = false

Note: Replace the DemoDB by your database name.

1 comment: