Я пробовал несколько разных вещей, но по-прежнему получаю ошибку 2059.
Вот код метода, который я использую для подключения к очереди:
Код: Выделить всё
///
/// Connects to the IBM MQ queue using the given parameters.
///
///
One of the MQC.TRANSPORT_MQSERIES_values
/// The host name for the queue
/// The channel name for the queue
/// The queue manager name
/// The queue name
/// Output parameter representing connection to MQ Queue Manager.
/// Flag indicating where to use SSL connection to queue.
/// An object representing the queue connection.
private static MQQueue GetConnectionToQueue(
string connectionType,
string hostName,
string channelName,
string queueManagerName,
string queueName,
out MQQueueManager queueManager,
bool isSsl)
{
var connectionProperties = new Hashtable
{
// Add the connection type
{ MQC.TRANSPORT_PROPERTY, connectionType }
};
// Set up the rest of the connection properties, based on the
// connection type requested
switch (connectionType)
{
case MQC.TRANSPORT_MQSERIES_BINDINGS:
break;
case MQC.TRANSPORT_MQSERIES_CLIENT:
case MQC.TRANSPORT_MQSERIES_XACLIENT:
case MQC.TRANSPORT_MQSERIES_MANAGED:
connectionProperties.Add(MQC.HOST_NAME_PROPERTY, hostName);
connectionProperties.Add(MQC.CHANNEL_PROPERTY, channelName);
break;
}
// SSL stuff
if (isSsl)
{
connectionProperties.Add(MQC.SSL_CERT_STORE_PROPERTY, "*USER");
connectionProperties.Add(MQC.SSL_CIPHER_SUITE_PROPERTY, "SSL_RSA_WITH_AES_128_CBC_SHA256");
// I also tried it with this CIPHER, but it doesn't work either
//connectionProperties.Add(MQC.SSL_CIPHER_SUITE_PROPERTY, "TLS_RSA_WITH_AES_256_CBC_SHA256");
connectionProperties.Add(MQC.MQCA_CERT_LABEL, "ibmwebspheremquf8472v");
//connectionProperties.Add(MQC.SSL_CIPHER_SPEC_PROPERTY, "TLS_RSA_WITH_AES_128_CBC_SHA256");
}
// Create a connection to the queue manager using the connection
// properties just defined
queueManager = new MQQueueManager(queueManagerName, connectionProperties);
// Set up the options on the queue we want to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we want to open,and the open options
var queue = queueManager.AccessQueue(queueName, openOptions);
return queue;
}
У меня есть сертификат SSL настроен на канале экземпляра MQ, работающего в контейнере Docker Linux, и я могу подтвердить, что могу поместить сообщение в очередь через SSL, используя другую программу, предоставленную моей компанией. Но я не могу подключиться к очереди через SSL с помощью кода C#, показанного выше.
Я также импортировал сертификат в свои личные сертификаты, как показано ниже. Я включил ведение журнала, но получаю много низкоуровневых журналов без особой реальной помощи. Например:
Код: Выделить всё
0000024C 16:49:17.457614 14024.1 Constructing IBM.WMQ.MQERD#005DDE0E MQMBID sn=p935-001-240405 su=_o1_M5vNNEe6mUKqTP0CEtw pn=basedotnet/nmqi/MQERD.cs
0000024D 16:49:17.458034 14024.1 -------------{ MQERD.ReadStruct(Byte [ ],int) inputs [System.Byte[]] [28]
0000024E 16:49:17.458172 14024.1 -------------} MQERD.ReadStruct(Byte [ ],int) rc=OK returns [8]
0000024F 16:49:17.459110 14024.1 New MQException CompCode: 2 Reason: 2059
[img]https:/ /i.sstatic.net/0k0Dz2CY.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/785 ... with-net-8
Мобильная версия