[英].Net : Could not load type 'IBM.WMQ.ManagedCommonServices' from assembly 'IBM.XMS.Client.WMQ, Version=8.0.0.7
Using a .net framework Web API project we want to create a listener(consumer) for our MQ queue.我们希望使用 .net 框架 Web API 项目为我们的 MQ 队列创建一个侦听器(消费者)。 We are using XMS.Net as we are interested in asynchronous style of receiving messages.
我们正在使用 XMS.Net,因为我们对接收消息的异步方式感兴趣。 However, while creating a connection we are getting error:
但是,在创建连接时出现错误:
Could not load type 'IBM.WMQ.ManagedCommonServices' from assembly 'IBM.XMS.Client.WMQ, Version=8.0.0.7, Culture=neutral, PublicKeyToken=d2666ab12fca862b'.
无法从程序集“IBM.XMS.Client.WMQ,Version=8.0.0.7,Culture=neutral,PublicKeyToken=d2666ab12fca862b”加载类型“IBM.WMQ.ManagedCommonServices”。
As per http://www-01.ibm.com/support/docview.wss?uid=swg1IC89514 this issue is fixed but we are still facing it using version 8.0.0.7.根据http://www-01.ibm.com/support/docview.wss?uid=swg1IC89514 ,此问题已解决,但我们仍面临使用版本 8.0.0.7 的问题。
This is working fine for.Net framework console application but with Web API project it is failing.这对于 .Net 框架控制台应用程序工作正常,但对于 Web API 项目它失败了。
As workaround we also tried adding following in app.config for Web API but no luck -作为解决方法,我们还尝试在 Web API 的 app.config 中添加以下内容,但没有成功 -
<appSettings> <add key="MQCSCLASS" value="amqmdnet(IBM.WMQ.ManagedCommonServices)"/> </appSettings>
Note: The MQ client is not installed on my machine.注意:我的机器上没有安装 MQ 客户端。 We have referred - amqmdmsg, amqmdnet, amqmdnm, amqmdnsp, amqmdxcs dlls into the project.
我们已将 amqmdmsg、amqmdnet、amqmdnm、amqmdnsp、amqmdxcs dll 引用到项目中。
If you are using MQ v9.1, you can try the following steps如果您使用的是 MQ v9.1,您可以尝试以下步骤
1) SET the following variable in the environment DEVPATH=&RedistributablePackagePath&\bin 1)在环境DEVPATH=&RedistributablePackagePath&\bin中设置如下变量
2) Add binding redirect tag to the App.config file of the application as the application was compiled using a lower MQ version and it has to be run against a higher version. 2) 将绑定重定向标记添加到应用程序的 App.config 文件中,因为应用程序是使用较低的 MQ 版本编译的,并且必须针对较高版本运行。 For this you can copy the content of NonPrimaryRedirect.config file located at "&MQInstallPath&\Tools\dotnet\samples\cs\base"
为此,您可以复制位于“&MQInstallPath&\Tools\dotnet\samples\cs\base”的 NonPrimaryRedirect.config 文件的内容
Note: You have to modify the "newVersion" attribute value in the app.config file to the version you want to run against in your case it should be 9.1.0.0 and modify the "href" to the redistributable package path.注意:您必须将 app.config 文件中的“newVersion”属性值修改为您要运行的版本,在您的情况下它应该是 9.1.0.0,并将“href”修改为可再发行包路径。
3) Add the following tags into the app.config file 3)在app.config文件中添加如下标签
<runtime>
<developmentMode developerInstallation="true" />
</runtime>
<appSettings>
<add key="MQCSCLASS"
value="amqmdnet(IBM.WMQ.ManagedCommonServices)"/>
</appSettings>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.