admin管理员组

文章数量:1304188

We have signed up for a service where messages can be delivered to us through their IBM message queue.

What works : We have the server certificates setup, ips whitelisted, and have tested the commands (amqsbcgc) and (amqssslc) which work, we are able to see the queue through those commands in the command prompt.

What I'm trying to do : Using that same connection logic, connect via C# so I can connect to the queue, parse each message, and then clear the message from the queue.

Here is the code that I'm trying to run:

using IBM.WMQ;

class Program
{
    static void Main(string[] args)
    {
        Environment.SetEnvironmentVariable("MQCHLTAB", "TABNAMEHERE.tab");
        Environment.SetEnvironmentVariable("MQCHLLIB", @"C:\Program Files\IBM\WebSphere MQ\CCDT");     
        Environment.SetEnvironmentVariable("MQSSLKEYR", @"C:\Program Files\IBM\WebSphere MQ\ssl\cert");

        try
        {
            // Create a connection to the queue manager
            MQQueueManager qMgr = new MQQueueManager("AIM4");
            Console.WriteLine("Connected to queue manager.");

            // Disconnect from the queue manager
            qMgr.Disconnect();
            Console.WriteLine("Disconnected from queue manager.");
        }
        catch (MQException mqe)
        {
            Console.WriteLine("An MQException occurred: " + mqe.Message);
        }
        catch (Exception ex)
        {
            Console.WriteLine("An unexpected exception occurred: " + ex.Message);
        }
    }
}

Here is the message I'm getting back: SSL_HANDSHAKE_ERROR. Secure Sockets Layer return code 406. SSL_HANDSHAKE_STAGE: gsk_secure_soc_init

I don't really understand how amqsbcgc can connect just fine, even when i'm using the same server environment variables, and getting issues

Any guidance is greatly appreciated!

We have signed up for a service where messages can be delivered to us through their IBM message queue.

What works : We have the server certificates setup, ips whitelisted, and have tested the commands (amqsbcgc) and (amqssslc) which work, we are able to see the queue through those commands in the command prompt.

What I'm trying to do : Using that same connection logic, connect via C# so I can connect to the queue, parse each message, and then clear the message from the queue.

Here is the code that I'm trying to run:

using IBM.WMQ;

class Program
{
    static void Main(string[] args)
    {
        Environment.SetEnvironmentVariable("MQCHLTAB", "TABNAMEHERE.tab");
        Environment.SetEnvironmentVariable("MQCHLLIB", @"C:\Program Files\IBM\WebSphere MQ\CCDT");     
        Environment.SetEnvironmentVariable("MQSSLKEYR", @"C:\Program Files\IBM\WebSphere MQ\ssl\cert");

        try
        {
            // Create a connection to the queue manager
            MQQueueManager qMgr = new MQQueueManager("AIM4");
            Console.WriteLine("Connected to queue manager.");

            // Disconnect from the queue manager
            qMgr.Disconnect();
            Console.WriteLine("Disconnected from queue manager.");
        }
        catch (MQException mqe)
        {
            Console.WriteLine("An MQException occurred: " + mqe.Message);
        }
        catch (Exception ex)
        {
            Console.WriteLine("An unexpected exception occurred: " + ex.Message);
        }
    }
}

Here is the message I'm getting back: SSL_HANDSHAKE_ERROR. Secure Sockets Layer return code 406. SSL_HANDSHAKE_STAGE: gsk_secure_soc_init

I don't really understand how amqsbcgc can connect just fine, even when i'm using the same server environment variables, and getting issues

Any guidance is greatly appreciated!

Share Improve this question edited Feb 5 at 13:52 Ecto asked Feb 4 at 20:54 EctoEcto 12 bronze badges 4
  • ibm/docs/en/storage-protect/… – Hans Passant Commented Feb 4 at 21:02
  • What errors show up in the queue manager log at the time you get SSL_HANDSHAKE_ERROR? Have you looked at AMQERR01.LOG on your client machine, if so did this log any errors? – JoshMc Commented Feb 4 at 21:35
  • So I have tried a few things since this post, and I am getting responses back from the server that state : "SSL_CIPHER_SPEC_ERROR: Cipher spec mismatch" which they did give me a cipher to use : ECDHE_RSA_AES_256_GCM_SHA384 but that is already in the TAB file Im wondering now if that cipher needs to be set in windows group policy? – Ecto Commented Feb 4 at 21:47
  • Edit the question to add the following: 1. MQ client version installed. 2. DIS CHL(*) ALL" output of the channel table. 3. DIS CHL(channel name from channel table for AIM4) ALL" from the queue manager. If amqsbcgc works with the same ENV variables, then it should work with the application of you are not on a very old release of the amqmdnet.dll. – JoshMc Commented Feb 4 at 22:46
Add a comment  | 

2 Answers 2

Reset to default 0

I'm not an IBM MQ .NET expert but some things don't look right.

Environment.SetEnvironmentVariable("NMQ_MQ_LIB", @"C:\Program Files\IBM\WebSphere MQ\bin\mqic.dll");

  1. That path is for an older release of IBM MQ (aka WebSphere MQ). Why aren't you using the latest release IBM MQ v9.4?
  2. That path is pointing to the 32-bit release of the MQ client library. So, your application is 32-bit and not 64-bit?

Environment.SetEnvironmentVariable("MQCHLLIB", @"C:\Program Files\IBM\WebSphere MQ\ssl");

You put the CCDT (TAB) file in the "ssl" directory? That's a strange place for it.

Environment.SetEnvironmentVariable("MQSSLKEYR", @"C:\Program Files\IBM\WebSphere MQ\ssl\cert");

Aren't you supposed to put the path plus cert name (without the ".kdb") in the environment variable?

If the error you are seeing indicates a cipher spec mismatch, then try TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 as specified in

https://www.ibm/docs/en/ibm-mq/9.4?topic=client-cipherspec-mappings-managed-net

本文标签: ibm mqInitial Client Connection to IBM MQ using CStack Overflow