且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过.net客户端通过SSL连接到IBM MQ

更新时间:2022-02-11 22:52:42

我遇到了相同的问题和错误消息.启用跟踪后,我能够隔离问题. 我一直想知道客户如何从商店中选择正确的客户证书.跟踪输出显示如下:

I had the same problem and error message. After enabling tracing I was able to isolate the problem. I always wondered, how the client is selecting the correct client certificate from the store. The trace output revealed following:

000001B2 15:53:46.828145   20776.10    Created an instance of SSLStreams
000001B3 15:53:46.828145   20776.10    Setting current certificate store as 'Computer'
000001B4 15:53:46.828145   20776.10    Created store object to access certificates
000001B5 15:53:46.834145   20776.10    Opened store
000001B6 15:53:46.834145   20776.10    Accessing certificate - ibmwebspheremqmyusername
000001B7 15:53:46.835145   20776.10    TLS12 supported - True
000001B8 15:53:46.837145   20776.10    Setting SslProtol as Tls
000001B9 15:53:46.837145   20776.10    Starting SSL Authentication

就我而言,我必须将客户端证书的友好名称设置为ibmwebspheremq myusername (用您的用户名替换"myusername"),然后在以及代码:

In my case, I had to set the friendly name of the client certificate to ibmwebspheremqmyusername (replace "myusername" with your userid) and set the label in the code aswell:

properties.Add(MQC.MQCA_CERT_LABEL, "ibmwebspheremqmyusername");  

要启用跟踪,请将以下内容添加到您的app.config/web.config中,该路径指向包含名为 mqtrace.config 的文件的位置:

To enable tracing, add following to your app.config/web.config where the path points to a location that contains a file named mqtrace.config:

<appSettings>
    <add key="MQTRACECONFIGFILEPATH" value="C:\MQTRACECONFIG" />
</appSettings>

mqtrace.config的示例内容(指定的目录必须预先存在):

Sample content of mqtrace.config (specified directories must exist in advance):

<?xml version="1.0" encoding="utf-8"?>
<traceSettings>
  <MQTRACELEVEL>2</MQTRACELEVEL>
  <MQTRACEPATH>C:\MQTRACEPATH</MQTRACEPATH>
  <MQERRORPATH>C:\MQERRORLOGPATH</MQERRORPATH>
</traceSettings>

以下是一些链接,以获取更多详细信息:

Here are some links for more detail:

追踪:
https://www.ibm .com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q123550_.htm 为什么贴标签:
http://www-01.ibm.com/support/docview.wss ?uid = swg21245474

Tracing:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q123550_.htm Why label:
http://www-01.ibm.com/support/docview.wss?uid=swg21245474