【发布时间】:2014-06-24 06:31:11
【问题描述】:
我正在尝试获取远程计算机中特定专用队列的消息计数。 我可以从我的本地机器上获取计数。
本地机器:
path=@".\Private$\Sample";
远程机器:
Path=@"RemoteMachineName\Private$\Sample";
完整代码:
当我尝试远程机器路径时,它会抛出错误无效路径。
如果有人能指导我解决问题,我将不胜感激?
var path ="FormatName:Direct=OS:RemoteMachineName\\private$\\sample";
MessageQueue queuename = new MessageQueue(path);
var mgmt = new MSMQManagement();
object machine = "RemoteMachineName";
object queuename = queue.Path;
object formatname = "Direct=OS";
mgmt.Init(ref machine, ref queuename, ref formatname);
int messageCount = mgmt.MessageCount;
MessageBox.Show(string.Format("Queue has {0} items", messageCount));
【问题讨论】: