SQLCLR 使用错误版本的 .NET Framework [英] SQLCLR using the wrong version of the .NET Framework

查看:27
本文介绍了SQLCLR 使用错误版本的 .NET Framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的开发服务器最近重新启动期间,SQL Server 开始为 SQLCLR 使用 .NET 4.0.这意味着在 SQL 中使用 CLR 没有任何效果,或者至少这是我通过阅读这些来源的理解:

During a recent restart of our development server the SQL Server started using .NET 4.0 for the SQLCLR. This means that nothing using the CLR in SQL works, or at least that's my understanding by reading these sources:

http://software.intel.com/en-us/blogs/2009/10/16/sql-server-2008-sqlclr-net-framework-version/

www.sqlskills.com/BLOGS/BOBB/post/On-SQL-Server-and-NET-40.aspx

我们得到的只是这种类型的错误消息:

All we get are error messages of this type:

Msg 6517, Level 16, State 1, Line 1 未能创建 AppDomainxxx.dbo[ddl].3".方法的类型签名与互操作不兼容.

Msg 6517, Level 16, State 1, Line 1 Failed to create AppDomain "xxx.dbo[ddl].3". Method's type signature is not Interop compatible.

运行语句(由@john-christensen 建议)

Running the statement (as suggested by @john-christensen)

select * from sys.dm_clr_properties

产生以下信息:

*Name*      *Value*
directory   C:WindowsMicrosoft.NETFramework64v4.0.30319
version     v4.0.30319
state       CLR is initialized

有谁知道如何解决这个问题,或者我们如何强制 SQL Server CLR 使用较早版本的框架?

Does anyone know how to solve this or how we can force SQL Server CLR to use an earlier version of the Framework?

推荐答案

通常,您可以通过在应用程序的配置文件中指定 supportedRuntime 标记来强制 .NET 应用程序使用特定的 .NET Framework 版本.

Typically you can force a .NET application to use a specific .NET Framework version by specifying the supportedRuntime tag in the application's config file.

所以您可以尝试在 SQL 实例的根路径下的 Binn 文件夹中创建一个 sqlservr.exe.config 并在其中指定您要使用的仅 .NET 版本不超过 3.5.查看此 MSDN 链接 了解配置文件的结构.

So you could try creating a sqlservr.exe.config in the Binn folder under the root path of the SQL instance and specify there that you would like to use only .NET versions up to 3.5. Check this MSDN link for the structure of the config file.

这篇关于SQLCLR 使用错误版本的 .NET Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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