数据库
首页 > 数据库> > SQL Server 2008 R2的C#CLR中的newtonsoft.json解析器 – 如何部署?

SQL Server 2008 R2的C#CLR中的newtonsoft.json解析器 – 如何部署?

作者:互联网

我创建了一个使用newtonsoft json解析器的CLR.

我需要部署CLR.我已经为解析器依赖创建了一个程序集:

CREATE ASSEMBLY [Newtonsoft.Json] FROM 'C:\share\Release\Newtonsoft.Json.dll' WITH PERMISSION_SET = UNSAFE

上面的语句会抛出一个错误:

`Assembly 'Newtonsoft.Json' references assembly 'system.runtime.serialization, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(failed to retrieve text for this error. Reason: 15105)).` Please load the referenced assembly into the current database and retry your request.

我正在使用解析器的7.xx版本.
我的目标是.NET 3.5

将CLR部署到sql server 2008 r2的正确步骤是什么?

解决方法:

对不起,我在评论中做了一个不正确的假设.默认情况下,SQL CLR仅支持GAC中的certain libraries.

要使用该库,您还需要明确添加它.

CREATE ASSEMBLY System_Runtime_Serialization FROM 'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\System.Runtime.Serialization.dll'
WITH PERMISSION_SET = UNSAFE
GO

如果您使用的是64位SQL Server,请确保使用Framework64而不是Framework.

标签:json,c,net,sql-server-2008-r2,sqlclr
来源: https://codeday.me/bug/20190623/1271462.html