Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am unable to connect to IBM MQ from C# console application with credentials. Here is the code. Its throwing "2035 Not Authorized" error.
C#
protected MQQueueManager mqQueueManager;

public override void Open() {
    Hashtable properties = new Hashtable();
    properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
    properties.Add(MQC.HOST_NAME_PROPERTY, mq_hostName);
    properties.Add(MQC.CHANNEL_PROPERTY, mq_channel);
    properties.Add(MQC.PORT_PROPERTY, mq_port);
    properties.Add(MQC.USER_ID_PROPERTY, mq_userName);
    properties.Add(MQC.PASSWORD_PROPERTY, mq_password);
    properties.Add(MQC.USE_MQCSP_AUTHENTICATION_PROPERTY, true);

    try
    {           
        mqQueueManager = new MQQueueManager(mq_queueManagerName, properties);
        Console.WriteLine("Connected to MQ");
    }
    catch (MQException e)
    {
        log.Fatal("MQ Queue Manager creation Error", e);
        throw e;
    }
}

Thanks
-Srini

What I have tried:

If I comment user name and password properties. It’s able to connect. Not sure, why it’s not working with credentials. Please let me know if anyone has encountered this issue and any pointers to resolve the same. Thanks in advance!
Posted
Updated 25-Aug-21 8:18am
v2

Most likely the username and/or password are not correct, or do not have access to the resource you are requesting. But you will need to contact IBM for support with their product.
 
Share this answer
 
Its an issue with user name. We are migrating Java application to .NET and in user name "user@domain" was there at the end. Looks like, this format is required for Java and its working fine there. When we use same user name in .NET, it was not working and throwing error "2035 MQRC_NOT_AUTHORIZED". Once we removed @domain from it, it started working.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900