gpt4 book ai didi

sql - 在 SQL Server 2012 中注册 CLR 函数(基于 WCF)

转载 作者:行者123 更新时间:2023-12-04 12:48:24 31 4
gpt4 key购买 nike

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

Msg 6544, Level 16, State 1, Line 1
CREATE ASSEMBLY for assembly 'System.ServiceModel' failed because assembly 'microsoft.visualbasic.activities.compiler' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub.



我搜索了解决方案,似乎很少有人遇到同样的问题,到目前为止还没有解决方案。

使用 MSMQIntegrationBinding 的主要原因我们想确保每条消息只传递一次。如您所见,我对 ExactlyOnce 非常感兴趣。正常 system.messaging 类中不存在的属性。我们处理数千条消息,消息的排序非常重要,每条消息都带有一个 id 标记,如果发送的任何消息的 id 小于之前发送的消息,客户端系统就会停止(大问题)。

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

最佳答案

我和你有同样的问题,不知道有没有解决办法。我发现的是:

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.

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 .

所以,我的猜测是,在不久的将来,没有解决办法。我们要做的是以另一种方式编码。

关于sql - 在 SQL Server 2012 中注册 CLR 函数(基于 WCF),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15173120/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com