使用 C# 和 .Net 连接到远程队列管理器
我编写了一个使用此函数调用连接到本地队列管理器的应用程序:
MQQueueManager mqQMgr = new MQQueueManager("QM_QueueManagerName");
现在我需要连接到另一台计算机上的远程队列管理器。
我可以使用 MQ Explorer 从我的开发 PC 成功连接到远程队列管理器,使用 QM_ComputerName
作为队列管理器名称,S_ComputerName
作为通道,ComputerName 作为连接名称。所以可以从我的桌面访问它。
但是,当我尝试通过 .Net 连接时,无论我如何尝试,都会收到 MQRC_Q_MGR_NAME_ERROR
。
我尝试指定
MQEnvironment.Hostname = "ComputerName";
MQEnvironment.Channel = "S_ComputerName ";
and then calling
mqQMgr = new MQQueueManager("QM_ComputerName");
I also tried calling
mqQMgr = new MQQueueManager("QM_ComputerName", "S_ComputerName", "ComputerName");
在两种情况下都会出错。
有人可以建议吗?
I wrote an application that connected to local queue manager using this function call:
MQQueueManager mqQMgr = new MQQueueManager("QM_QueueManagerName");
Now I need to connect to remote queue manager on another computer.
I can successfully connect to remote queue manager using MQ Explorer from my development PC using QM_ComputerName
as queue manager name, S_ComputerName
as channel and ComputerName as connection name. So it is accessible from my desktop.
However, when I try to connect via .Net I get MQRC_Q_MGR_NAME_ERROR
no matter what I try.
I tried specifying
MQEnvironment.Hostname = "ComputerName";
MQEnvironment.Channel = "S_ComputerName ";
and then calling
mqQMgr = new MQQueueManager("QM_ComputerName");
I also tried calling
mqQMgr = new MQQueueManager("QM_ComputerName", "S_ComputerName", "ComputerName");
I get error in both cases.
Anyone can advise?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是我让它工作的方式:
This is how I got it to work:
也许这个示例代码 会有帮助。
我链接到 V7 文档。理想情况下,您将使用 V7 客户端并与 V7 服务器通信,因为这些中的 .Net 功能比 V6 有了很大改进。此外,V6 已于 2011 年 9 月终止生命周期,因此最好现在直接升级到 v7,避免以后升级。
如果您需要 v7 WMQ 客户端(其中包括更新的 .Net 示例和类),请转至 IBM MQ 客户端下载页面(需要 IBM ID,但可以免费下载)。
更新 20180810: 已更改链接以指向 IBM 的所有 IBM MQ 客户端下载的新页面。
Perhaps this sample code will help.
I linked to the V7 docs. Ideally you will be using both the V7 client and talking to a V7 server because the .Net functionality is much improved in these over V6. Also, V6 is end-of-life as of September 2011 so it would be good to go straight to v7 now and avoid the upgrade later.
If you need the v7 WMQ client, which includes the updated .Net samples and classes, go to IBM MQ Client Downloads page (requires IBM ID but is a free download).
UPDATE 20180810: Changed link to point to IBM's new page for all IBM MQ client downloads.