Search code examples
asp.netwindowsdocker.net-coreibm-mq

Error when calling IBM MQ client from inside Docker container


I developed a sample ASP.Net 4.8 application which is using IBM MQ client amqmdnetstd.dll (version 9.3.4.1)

IBM MQ client is not installed on machine, and I have just referenced this DLL in Visual Studio and when I press F5 then it works fine.

But when I publish the app and run it inside Docker container then it throws following exception:

Error Message: The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception. 

Stack Trace:
    at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
    at StudentManagementSystem.Classes.Middleware.CreateQueueManager() in C:\Code\StudentManagementSystem\StudentManagementSystem\Classes\Middleware.cs:line 37 Inner Exception: System.ArgumentException: The path is not of a legal form.
    at System.IO.Path.NewNormalizePath(String path, Int32 maxPathLength, Boolean expandShortPaths)
    at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
    at System.IO.Path.GetFullPathInternal(String path)    at System.IO.Path.GetFullPath(String path)
    at System.IO.FileSystemWatcher.StartRaisingEvents()
    at IBM.WMQ.MQClientCfg.CheckForMqclientIniFileChanges()
    at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
    at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
    at IBM.WMQ.MQQueueManager..cctor()

Why the application works from Visual Studio but not from Docker container? That amqmdnetstd.dll is present in bin directory.


Solution

  • I developed a sample ASP.Net 4.8 application which is using IBM MQ client amqmdnetstd.dll (version 9.3.4.1)

    You should be following the IBM MQ 9.3 System Requirements for Windows. You are using MQ v9.3.4.1, so you need to use .NET v6.

    See: Requirements for IBM MQ classes for .NET