SQLCLR using the wrong version of the .NET Framework(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQLCLR 使用错误版本的 .NET Framework
基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
