You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IBMXMSDotnetClient连接失败:MQTSH错误与MQRC2059码排查求助

XMS库.NET Standard2版本迁移中的MQRC_Q_MGR_NOT_AVAILABLE(2059)错误排查

正在迁移并确保XMS库的.NET Standard2版本可用,解决TLS及证书相关问题后,出现连接错误,错误码为MQRC_Q_MGR_NOT_AVAILABLE(2059),相关日志如下:

12:48:39.989069  8960.0001  IBM.WMQ.Nmqi.MQEncryptedSocket            ----+----+  <  ClientValidatingServerCertificate(Object,X509Certificate,X509Chain,SslPolicyErrors) rc=OK exit
12:48:39.989069  8960.0001  IBM.WMQ.Nmqi.MQEncryptedSocket            ----+----  d  SSL Authentication completed

..

12:48:40.098529  8960.0001  IBM.WMQ.Nmqi.MQEncryptedSocket            ----+----+-  <  Read(byte[], int, int) rc=OK exit
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  d  --------------------------
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  d  Receive Buffer

Length = 0x8000 (32768) bytes start=0 count=40

        offset        : 0 1 2 3  4 5 6 7  8 9 A B  C D E F
0x00000000 (       0) : 54534820 00000028 02050a00 00000000 : TSH....(......
0x00000010 (      16) : 00000000 22020000 e4040000 0c000000 : ...."..?.....
0x00000020 (      32) : 18000000 3d000000                   : ...=...

12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  d  --------------------------
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  d  Data Length --> 40
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  <  Receive(ref byte [ ],ref int,ref int) rc=OK exit
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----  d  Bytes Read from Socket = 40
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+  >  ReadStruct(Byte [ ],int) entry [o] System.Byte[], [o] 0
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+  <  ReadStruct(Byte [ ],int) rc=OK exit [o] 28
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+  >  CheckTSH(byte [ ]) entry [o] System.Byte[]
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+  <  CheckTSH(byte [ ]) rc=OK exit [o] True
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  >  AnalyseErrorSegment(MQTSH) entry [o] IBM.WMQ.MQTSH#024F4A7C
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+-  >  GetLength() entry
12:48:40.098529  8960.0001  IBM.WMQ.MQTSH                             ----+----+-  <  GetLength() rc=OK exit [o] 28
12:48:40.098529  8960.0001  IBM.WMQ.MQERD                             ----+----+-  >  ReadStruct(Byte [ ],int) entry [o] System.Byte[], [o] 28
12:48:40.098529  8960.0001  IBM.WMQ.MQERD                             ----+----+-  <  ReadStruct(Byte [ ],int) rc=OK exit [o] 12
12:48:40.098529  8960.0001                                            ----+----+  d  New MQException CompCode: 2 Reason: 2059
12:48:40.098529  8960.0001                                            ----+----+  d  New NmqiException CompCode: 2 Reason: 2059
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----+  <  AnalyseErrorSegment(MQTSH) rc=OK exit
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+----  <  ReceiveTSH(MQTSH) rc=OK exit
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+---  d  Exception in method InitialiseSession()
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+---  X  CompCode: 2, Reason: 2059
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+---  <  InitialiseSession() rc=OK exit
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+--  d  Exception in method Connect(MQConnectionSecurityParameters)
12:48:40.098529  8960.0001  IBM.WMQ.MQTCPConnection                   ----+--  X  CompCode: 2, Reason: 2059

错误细节解读

日志显示SSL认证已成功完成,但在InitialiseSession()方法执行阶段抛出2059错误,该错误表面指向队列管理器不可用,实际根因在于TLS/SSL密码套件不兼容:
-.NET 7之前的托管代码无法强制指定密码套件,日志信息存在误导性;
-WebSphere MQ未在初始握手阶段限制允许的密码套件,导致后续会话初始化失败。

解决方案

  • 将密码套件配置为ANY或类似通配选项,可直接解决连接问题;
  • 也可尝试在初始SSL交换完成后创建新的SSL套接字,规避密码套件不兼容问题。

内容的提问来源于stack exchange,提问作者llarsson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 16:35:53