Type initializer for IBM.WMQ.MQQueueManager throws an exception

zhiyuan_ picture zhiyuan_ · Apr 18, 2012 · Viewed 12.7k times · Source

When I connect WebSphere MQ using C# without installing MQ server and client, I get the exception The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception. I add the reference of two MQ dlls, amqmdnet.dll and amqmdxcs.dll from MQ server, but it doesn't work. How can I connect to MQ without installing MQ server or client? Thank you!

Answer

Shashi picture Shashi · Apr 18, 2012

I don't recommend using MQ client libraries without installing them. Installation ensures that all the required binaries are installed and registered with GAC. Adding reference to amqmdxcs is not required. Just a reference to amqmdnet is enough.

So it's better to install MQ client and run your application.