【发布时间】:2017-04-21 10:01:59
【问题描述】:
我对 MQ 非常陌生,并试图在我的机器上配置它。要求是设置 MQ,以便我可以使用我的 C#.NET 代码在 MQ 中将 XML 文件作为消息发送/接收。我已经在我的机器上安装了 IBM WebSphere MQ 9.0 版本。据我所知,我至少需要设置队列管理器、队列和通道来实现这一点。所以我试图在我的 MQ 中设置这些。但是,当我尝试运行我的代码时,我收到错误“MQRC_NOT_AUTHORIZED”。
谁能指导我设置这些东西,以便通过 .NET 共享文件的场景可以工作?我猜在这种情况下客户端和服务器都将在我的机器上本地?在创建队列、通道等时有许多参数可供选择,这让我感到困惑,我想我在设置中选择了不正确的定义。
这是我的 .Net 代码:
using IBM.WMQ;
using System;
using System.Collections;
namespace MQTest
{
class MQTest
{
public MQQueueManager ConnectMQ()
{
MQQueueManager queueManager;
// Setup connection information
Hashtable queueProperties = new Hashtable();
queueProperties[MQC.HOST_NAME_PROPERTY] = "localhost";
queueProperties[MQC.PORT_PROPERTY] = 1414;
queueProperties[MQC.CHANNEL_PROPERTY] = "QM._TEST.SVRCONN";
try
{
// Attempt the connection
queueManager = new MQQueueManager("QM_TEST", queueProperties);
Console.WriteLine("Connected Successfully");
}
catch (MQException mexc)
{
// TODO: Setup other exception handling
throw new Exception(mexc.Message
+ " ReasonCode: " + mexc.ReasonCode
+ mexc.StackTrace, mexc);
}
// For now, return the queueManager to use in reading/writing messages next
return queueManager;
}
}
}
这是我的 MQ 设置的快照:
【问题讨论】:
-
出现错误时 AMQERR01.LOG 中有什么内容。