'IBM MQ Windows Client C# tring to connect to server fails with 2298 error

i am new in MQ, but have to make an Application for my company. I need to get Messages in C# from an MessageQueue, i tried the example SimpleGet.cs, which was in the 8.0.0.10 Windows 64bit client sample folder. I can reach the point where it tries to connect to the QueueMessenger, where it throws the 2298 error.

 Console.Write("Connecting to queue manager.. ");
                queueManager = new MQQueueManager(queueManagerName, properties);

The error message is:

MQException caught: 2298 - 2298    bei
IBM.WMQ.MQQueueManager.Connect(String queueManagerName)    bei
IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable
properties)    bei SimpleGet.SimpleGet.GetMessages() in C:\Program
Files\IBM\WebSphere
MQ\Tools\dotnet\samples\cs\base\SimpleGet\SimpleGet.cs:Zeile 318.


Solution 1:[1]

I have fixed it by installing a newer version of MQ(8.0.0.10) now it is working

Solution 2:[2]

Working for .Net 6.0 (IBM MQ 9 Client)

If you are using IBM MQ Dotnet Client ver 9 or above then you need to set MQC.TRANSPORT_MQSERIES_MANAGED for the MQC.TRANSPORT_PROPERTY instead of MQC.TRANSPORT_MQSERIES_CLIENT as seen below:

connectionProperties = new Hashtable()
    {
        { MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },
        { MQC.HOST_NAME_PROPERTY, hostName },
        { MQC.PORT_PROPERTY, port },
        { MQC.CHANNEL_PROPERTY, channel },
        { MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT_Q_MGR },
        { MQC.USER_ID_PROPERTY, user },
        { MQC.PASSWORD_PROPERTY, password }
    };

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Abdullah Hashim