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

newtonsoft.json parser in a C# CLR for SQL Server 2008 R2 - How to deploy?(SQL Server 2008 R2 的 C# CLR 中的 newtonsoft.json 解析器 - 如何部署?)
本文介绍了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 解析器 - 如何部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)