在SQL Server 2012中注册CLR函数(基于WCF) [英] Register CLR function (WCF based) in SQL Server 2012

查看:97
本文介绍了在SQL Server 2012中注册CLR函数(基于WCF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于CLR的存储过程,该存储过程使用 MsmqIntegrationBinding 将消息发布到远程MSMQ。在SQL Server 2005中,一切工作正常,但现在假设发生了从2005年到2012年的升级。我试图在SQL Server 2012中注册CLR(SP),但是在注册 System.ServiceModell.DLL 时出现了以下错误。

I have a CLR based stored procedure which used MsmqIntegrationBinding to post messages to remote MSMQ's. Everything was working fine in SQL Server 2005 but now there is an upgrade from 2005 to 2012 suppose to happen. I tried to register the CLR (SP) in SQL Server 2012 but while registering System.ServiceModell.DLL it came up with the following error.


Msg 6544,级别16,状态1,行1

为组装'系统创建组件。 ServiceModel失败,因为程序集 microsoft.visualbasic.activities.compiler格式错误或不是纯.NET程序集。
不可验证的PE标头/本地存根。

我在搜索该决议,看来其他人很少有同样的问题,到目前为止,还没有解决方案。

I searched for the resolution and it appears that few other people are having the same problem and as of now there is no solution to it.

使用 MSMQIntegrationBinding 的主要原因是我们要确保每个消息仅传递一次。如您所见,我对 ExactlyOnce 属性非常感兴趣,该属性在普通的system.messaging类中不存在。我们处理成千上万条消息,消息的排序非常重要,而且每条消息都带有一个ID,如果发送的任何ID的ID小于以前发送的消息,则客户机系统将暂停(这是大问题)。

The primary reason for using MSMQIntegrationBinding is we wanted to make sure that each message is delivered only once. As you can see that I was pretty much interested in the ExactlyOnce property which is not there in the normal system.messaging class. We process thousand of messages and ordering of messages is very important further more each message is stamped with an id and if any message is sent which has an id that is less than the message previously sent the client system halts (big problem).

我还使用system.messaging重写了CLR存储过程。我只需要建议是否可以支持我上面提到的方案。

I also have rewritten the CLR stored proc using system.messaging. I just need suggestions whether it can support the scenario I mentioned above.

推荐答案

我和您有同样的问题,我不知道不知道是否有解决方案。我发现的是:

I have the same issue as you, and I don't know if there's a solution for it. What I have found is:


.NET程序集有两种类型。纯.NET程序集仅包含MSIL指令。混合程序集包含非托管机器指令和MSIL指令。通常,混合程序集由C ++编译器使用/ clr开关进行编译,但包含由本机C ++代码产生的机器指令。

There are two types of .NET assemblies. Pure .NET assemblies only contain MSIL instructions. Mixed assemblies contain both unmanaged machine instructions and MSIL instructions. Mixed assemblies in general are compiled by C++ compiler with /clr switch but contain machine instructions resulting from native C++ code.

无论哪个版本的SQL Server,CREATE ASSEMBLY仅允许纯.NET程序集要注册。 SQL Server一直要求要使用CREATE ASSEMBLY加载到SQL Server数据库中的程序集仅包含MSIL指令(纯程序集)。如果要注册的程序集是混合程序集,则CREATE ASSEMBLY将引发上述错误。

Regardless which version of SQL Server, CREATE ASSEMBLY only allows pure .NET assemblies to be registered. SQL Server has always required that an assembly to be loaded into SQL Server database with CREATE ASSEMBLY contains only MSIL instructions (pure assembly). CREATE ASSEMBLY will raise the above error if an assembly to be registered is mixed assembly.

来自 http: //blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list.aspx

重点是我们确实需要引用 System.ServiceModel

The point is that we really need to refer to System.ServiceModel.

因此,我的猜测是,在不久的将来,还没有解决方案。我们要做的是用另一种方式编写代码。

So, my guess is that, in the near future, there is no fix for it. What we have to do is code in another way.

这篇关于在SQL Server 2012中注册CLR函数(基于WCF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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