使用 .net 配置 mq websphere 7



我正在尝试使用 c# 连接到远程队列。我尝试了很多方法连接到远程队列,但它总是失败并出现常见错误,例如:MQRC_CHANNEL_CONFIG_ERRORMQRC_HOST_NOT_AVAILABLE

我正在做的是这样的:

        string channel = "QM_TEST.SVRCONN"; 
        string hostname = "<serverIp>"; 
        string queueName = "QM_TEST"; 
        string port = 1414; 
        props.Add(MQC.HOST_NAME_PROPERTY, hostname); 
        props.Add(MQC.CHANNEL_PROPERTY, channel); 
        props.Add(MQC.PORT_PROPERTY, port ); 
        props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED); 
        MQQueueManager mqQueue = new MQQueueManager(queueName, props); 

我尝试更改此设置,但都失败了。

我认为我的问题是服务器配置。您能否为我指出有关如何配置服务器并使用 .NET 连接到它的完整指南?

我的问题是使用 .net 连接到远程服务器,而不是本地服务器。

谢谢!

问题是客户端和服务器之间的CCSID不同。

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaf.doc%2Fcs12480_.htm

在客户端,我不得不把

Environment.SetEnvironmentVariable("MQCCSID", "437");

这就是为什么我得到:

MQRC_CHANNEL_CONFIG_ERROR 

我猜问题(或至少是一个问题)在这里:

MQQueue mqQueue = new MQQueueManager(queueName, props);

这应该是

queueManager = new MQQueueManager(queueManagerName, properties);

如果已将 WebSphere MQ 客户机安装到缺省位置,那么以下目录下有许多样本程序:

C:Program Files (x86)IBMWebSphere MQtoolsdotnetsamplescsbase

那里有许多用于各种任务的示例程序。 如果您安装了最新的 V7.1 客户端,您将看到以下程序:

SimpleAsyncPut
SimpleClientAutoReconnectGet
SimpleClientAutoReconnectPut
SimpleGet
SimpleMessageProperties
SimplePublish
SimplePut
SimpleReadAhead
SimpleSharingConversation
SimpleSubscribe
SimpleXAGet
SimpleXAPut

还有 WCF 和 XMS 示例。

如果您需要客户端代码,请参阅我对另一个 SO 问题的回答 此处的链接.

更新:

这是正常的诊断过程。

  1. 如果 WMQ 组件是通过从其他位置重新定位库或类来安装的,请使用供应商提供的完整客户端媒体执行安装。 这包括对诸如跟踪、dspmqver 等实用程序进行故障排除。 它还解决了任何库或类不匹配的问题。
  2. 使用预编译的客户端程序测试连接。 amqsputcamqsgetcamqsbcgc程序需要MQSERVER环境变量,如此处所述。 来自SupportPac MA01的Q程序是一个单独的下载,但具有不需要任何环境变量,CCDT文件或其他依赖项的优点。
  3. 如果示例程序失败,请在 [WMQ install]/qmgrs/[QMgr name]/errors/AMQERR01.LOG 处检查 QMgr 的错误日志以获取消息。 还要检查 FDC 文件和 [WMQ install]/errors 中的错误。
  4. 如果 QMgr 端没有错误,请在使用客户端跟踪时再次尝试连接,如此处和此处所述。

大多数客户机问题都可以通过安装 IBM 提供的完整 WMQ 客户机来解决。(相反,这意味着大多数人是通过抓取DLL或JAR文件进行安装的。 如果问题仍然存在,QMgr 和客户端上的错误日志检查通常会揭示根本原因。 如果这些不起作用,则跟踪通常会诊断剩余的问题。

更新 2:
根据在 MQSeries.net 发布的错误消息,通道设置了安全出口。 安全出口是通道在启动通道时调用的外部代码。 如果没有访问出口的代码或文档,就无法知道出口的期望或作用。 如果退出是内部编写的,则需要与程序员交谈以弄清楚它需要什么。如果退出是商业产品,那么您将需要获取其文档。

或者,更改通道,使SCYEXIT为空以禁用退出。

MQSeries.net 公布的数据如下:

MQ9575: DCE Security: failed to get the user's login name.
EXPLANATION:
System call 192.168.50.55 to get the login name of the user running WebSphere
MQ client application process 5 failed with error value -1. This occurred in
security exit function create_cred. The exit will now attempt to open channel
using the DCE default login context.
ACTION:
If you wish to run using the DCE default login context take no action. If you
wish to run using the user's login name as the DCE security exit principal
examine the documentation for the operating system on which you are running MQ
clients and reconfigure the operating system as necessary to allow the
192.168.50.55 call to succeed. 

请注意,它指出呼叫在安全出口中失败。

最新更新