SQL CLR-从2008 R2迁移到2012。 [英] SQL CLR - Migration from 2008 R2 to 2012.

查看:92
本文介绍了SQL CLR-从2008 R2迁移到2012。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL 2008 R2上有一堆SQL CLR程序集。这些程序集针对.Net Framework 3.5。给定SQL 2008支持的2.0 .NET Framework版本,我假设SQL从System GAC加载了安全程序集,并期望在SQL中安装不安全程序集。我对这些不安全程序集的引用是.NET 2.0版。现在,当我将此数据库还原到SQL 2012时,我的CLR代码失败,并显示未找到对不安全的程序集版本4.0的引用。我不明白这个错误。 DB mdf文件本身中存在不安全系统程序集的2.0版本。 SQL为什么要寻找4.0?我想我错过了 SQL支持.NET Framework的x版本的含义。

I have a bunch of SQL CLR assemblies on SQL 2008 R2. These assemblies were targeted with .Net Framework 3.5. Given SQL 2008 supported 2.0 .NET framework version, I am assuming SQL loaded the safe assemblies from System GAC and expected unsafe assemblies to be installed in SQL. My references to these unsafe assemblies are .NET version 2.0. Now when I restored this database to SQL 2012 my CLR code is failing with "reference to unsafe assembly version 4.0 not found". I did not understand this error. The 2.0 version of the unsafe system assembly exists in the DB mdf file itself. Why is SQL looking for 4.0? I think I am missing what "SQL supports x version of .NET framework" means.

推荐答案

我能够找到所面临问题的根本原因。 SQL 2012支持用于SQLCLR的.NET Framework 4.0,因此从4.0框架加载所有框架程序集。因此,我需要升级所有程序集以使用4.0框架程序集。 http://blogs.msdn.com/b/dohollan/archive/2012/04/20/sql-server-2012-sqlclr-net-framework-version.aspx?CommentPosted=true#commentmessage

I was able to get to the root cause of the issue I was facing. SQL 2012 supports .NET framework version 4.0 for SQLCLR and hence loads all framework assemblies from 4.0 framework. Hence I needed to upgrade all my assemblies to use 4.0 framework assemblies. http://blogs.msdn.com/b/dohollan/archive/2012/04/20/sql-server-2012-sqlclr-net-framework-version.aspx?CommentPosted=true#commentmessage

但是,即使在那之后,事情对我也没有用。事实证明,在4.0中,.NET将一些框架程序集(如System.ServiceModel)从Pure .Net程序集更改为混合模式程序集。 SQL CLR无法加载此类程序集。因此,所有依赖于2012年前的混合模式程序集的用户定义程序集在2012年都将无法再使用:(
最受打击的是以前可以正常运行的SQL和WCF集成,2012年,Sicne WCF依赖于ServiceModel。
更多信息< a href = http://blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list.aspx rel = nofollow> http://blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list。 aspx

But things didnt work for me even after that. It turns out in 4.0, .NET changed some framework assemblies like System.ServiceModel from Pure .Net assemblies to mixed mode assemblies. Such assemblies cannot be loaded by SQL CLR. So all user defined assemblies depending on mixed mode assemblies pre 2012 dont work anymore on 2012 :( Most badly hit are previously working SQL and WCF integrations completely breaking in 2012 sicne WCF depends on ServiceModel. More here http://blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list.aspx

我们最终在WCF操作上编写了一个简单的Web服务包装程序,并在SQLCLR中编写了一个Web服务客户端。

We ended up writing a simple Webservice wrapper over our WCF operation and writing a Webservice client in SQLCLR.

这篇关于SQL CLR-从2008 R2迁移到2012。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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