SQL Server 2008 R2 的 C# CLR 中的 newtonsoft.json 解析器 - 如何部署? [英] newtonsoft.json parser in a C# CLR for SQL Server 2008 R2 - How to deploy?

查看:41
本文介绍了SQL Server 2008 R2 的 C# CLR 中的 newtonsoft.json 解析器 - 如何部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created a CLR which uses the newtonsoft json parser.

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

I need to deploy the CLR. I have created an assembly for the parser dependency:

CREATE ASSEMBLY [Newtonsoft.Json] FROM 'C:shareReleaseNewtonsoft.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.

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

I am using version 7.xx of the parser. I am targeting .NET 3.5

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

What is the proper procedure for deploying the CLR to sql server 2008 r2?

推荐答案

对不起,我在评论中做出了错误的假设.SQL CLR 默认仅支持 GAC 中的某些库.

Sorry, I had made an incorrect assumption in my comment. Only certain libraries in the GAC are supported for SQL CLR by default.

为了使用该库,您还需要显式添加它.

In order to use that library, you'll need to explicitly add it as well.

CREATE ASSEMBLY System_Runtime_Serialization FROM 'C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication FoundationSystem.Runtime.Serialization.dll'
WITH PERMISSION_SET = UNSAFE
GO

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

If you are using 64-bit SQL Server, make sure you use Framework64 instead of Framework.

这篇关于SQL Server 2008 R2 的 C# CLR 中的 newtonsoft.json 解析器 - 如何部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆