0

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'.

enter image description here

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
arpymastro
  • 751
  • 3
  • 16
  • 34
  • Not supported at that version. – JoshMc Dec 05 '18 at 13:10
  • Suggest you to use MQ9.1 Redistributable Client. See here: https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.ins.doc/q122882_.htm – Shashi Dec 05 '18 at 14:52
  • @Shashi agreed, didn't have much time earlier, I think it was added at 9.0.5 (the last 9.0 CDS release) and is included in 9.1 LTS and CDS. Note that 9.1.1 CDS also now added support for .NET Standard (Core) for both MQ.NET and XMS.NET APIs. – JoshMc Dec 05 '18 at 18:42
  • @JoshMc - Yes, you are right. It was added in 9.0.5 and now rolled into 9.1 LTS. – Shashi Dec 06 '18 at 02:28
  • @JoshMc I am still getting same error with 9.1 also. If possible can you share a working sample with all appropriate dlls added in it? It will really help me troubleshoot. – arpymastro Dec 06 '18 at 08:12
  • @Shashi I am still getting same error with 9.1 also. If possible can you share a working sample with all appropriate dlls added in it? It will really help me troubleshoot – arpymastro Dec 06 '18 at 08:12
  • Did you get the redist client? – JoshMc Dec 06 '18 at 08:18
  • @JoshMc Client is not installed on my machine. I am referring the dlls in my project directly – arpymastro Dec 06 '18 at 10:16
  • The dlls should be from the redist zip. – JoshMc Dec 06 '18 at 13:42
  • @JoshMc can you please share the path from where I can download 9.1.0.1 redist packages? – arpymastro Dec 07 '18 at 05:48
  • Did you try to search for it on google? "mq 9.1.0.1 redist packages" worked for me. – JoshMc Dec 07 '18 at 08:27

1 Answers1

2

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

1) SET the following variable in the environment DEVPATH=&RedistributablePackagePath&\bin enter image description here

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>
subbaraoc
  • 1,123
  • 1
  • 8
  • 27
  • I dont have client installed locally on my machine. Will the above still work? – arpymastro Dec 06 '18 at 11:37
  • while setting env variable I am getting "RedistributablePackagePath is not recognized". Any idea? Or I am doing something wrong. – arpymastro Dec 06 '18 at 11:47
  • if you could can you share sample somewhere I could take a look at? – arpymastro Dec 06 '18 at 11:53
  • 1
    when i say redistribtable package i meant, the path where all the MQ & XMS .NET dlls are located.If the MQ dll's are located at C:\9.1.0.1-IBM-MQC-Redist-Win64\bin,the DEVPATH should be set to C:\9.1.0.1-IBM-MQC-Redist-Win64\bin. If you are executing the application from a command prompt then the environment variable should be set in the command prompt set DEVPATH=C:\9.1.0.1-IBM-MQC-Redist-Win64\bin then execute the application – subbaraoc Dec 06 '18 at 13:52
  • in binding redirect tag which dll related binding I need to add? – arpymastro Dec 07 '18 at 05:07
  • can you also please share download url for 9.1.0.1 redist packages? – arpymastro Dec 07 '18 at 05:25
  • https://www-945.ibm.com/support/fixcentral/swg/selectFixes?product=ibm%2FWebSphere%2FWebSphere+MQ&fixids=9.0.1.0-IBM-MQC-Redist-Win64&source=dbluesearch&function=fixId&parent=ibm/WebSphere You need to all the libraries,because XMS.NET has dependency on multiple dll's so you have to add binding redirect of all the dll's which are present in Nonprimaryredirect.config file – subbaraoc Dec 07 '18 at 09:27
  • @arpymastro if the answer helped please can you mark it as answer so that it will be useful for others – subbaraoc Mar 20 '19 at 16:08