简体   繁体   中英

.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. We are using XMS.Net as we are interested in asynchronous style of receiving messages. 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'.

在此处输入图像描述

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.

This is working fine for.Net framework console application but with Web API project it is failing.

As workaround we also tried adding following in app.config for Web API but no luck -

<appSettings> <add key="MQCSCLASS" value="amqmdnet(IBM.WMQ.ManagedCommonServices)"/> </appSettings>

Note: The MQ client is not installed on my machine. We have referred - amqmdmsg, amqmdnet, amqmdnm, amqmdnsp, amqmdxcs dlls into the project.

If you are using MQ v9.1, you can try the following steps

1) SET the following variable in the environment 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. For this you can copy the content of NonPrimaryRedirect.config file located at "&MQInstallPath&\Tools\dotnet\samples\cs\base"

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.

3) Add the following tags into the app.config file

<runtime>
<developmentMode developerInstallation="true" />
</runtime>
<appSettings>
   <add key="MQCSCLASS"
value="amqmdnet(IBM.WMQ.ManagedCommonServices)"/>
 </appSettings>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM