我對MQ很陌生,試圖在我的機器上進行配置。需要安裝MQ,以便我可以使用C#.NET代碼在MQ中以消息形式發送/接收XML文件。我在我的機器上安裝了IBM WebSphere MQ 9.0版本。據我瞭解,到目前爲止,我需要設置隊列管理器,隊列和通道來達到此目的。所以我試圖在MQ中設置它們。但是,當我嘗試運行我的代碼時,出現錯誤「MQRC_NOT_AUTHORIZED」。使用.Net連接到IBM WebSphere MQ會引發錯誤MQRC_NOT_AUTHORIZED
任何人都可以請指導我設置這些東西,以便通過.NET文件共享的場景將工作?我猜在這種情況下,我的機器上的客戶端和服務器都將在本地?在創建Queue,Channel等時有很多參數可供選擇,這些參數會讓我感到困惑,我想我在我的設置中選擇了不正確的定義。
這裏是我的.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在發生錯誤時有什麼內容。 – JoshMc