当我们试图使用PERMISSION_SET=UNSAFE或EXTERNAL_ACCESS部署程序集时,Server将收到以下错误消息:
CREATE ASSEMBLY for assembly 'System.ServiceModel.Internals' failed because
assembly 'System.ServiceModel.Internals' 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.**我们没有设置数据库trustworthy=ON,而是使用ALGORITHM = RSA_2048创建非对称密钥。以下是示例代码:
USE master;
GO
IF NOT EXISTS (SELECT 1 FROM sys.asymmetric_keys WHERE [name]='SampleClrKey')
BEGIN
CREATE ASYMMETRIC KEY [SampleClrKey] WITH ALGORITHM = RSA_2048
CREATE LOGIN [SampleClrLogin] FROM ASYMMETRIC KEY [SampleClrKey];
GRANT UNSAFE ASSEMBLY TO [SampleClrLogin];
END
GO但是这个错误并没有得到解决。我甚至为我的数据库和主数据库提供了对SampleClrLogin登录的sysadmin访问,但是它没有工作。你们能不能提供一些见解来解决这个问题。
发布于 2018-12-03 14:39:22
System.ServiceModel.Internals
你可以在那儿停下来。无法在SQL中使用WCF。SQL只支持纯MSIL程序集,而.NET 4.x中的WCF引用了一些混合模式程序集。
如果要从SQL调用web服务,则可以使用WebClient API或较低级别的HttpWebRequest,这两者都是在System.dll中实现的。
https://dba.stackexchange.com/questions/223976
复制相似问题