![](/img/trans.png)
[英]How to read MSMQ messages from a remote machine without installing message queueing on local machine?
[英]Can my machine read messages from another local machine if my MessageQueue is private?
我想從本地網絡上的另一台計算機接收消息,因此我以這種方式創建了MessageQueue
:
private static string QueueName = ".\\Private$\\Q1";
public void SendMessage()
{
if (!MessageQueue.Exists(QueueName))
MessageQueue.Create(QueueName);
//
}
public void ReceiveMessage()
{
// Connect to the a queue on the local computer.
MessageQueue myQueue = new MessageQueue(QueueName);
// Set the formatter to indicate body contains an Order.
myQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(Queue.Order) });
try
{
// Receive and format the message.
Message myMessage = myQueue.Receive();
///
}
我還嘗試使用@"MachineName\\QueueName"
格式創建我的MessageQueue
,但是收到了MessageQueueException。
如果轉到“計算機管理”並在“服務和應用程序”>“消息隊列”>“專用隊列”下查看,您是否看到名為“ Q1”的隊列? 如果是這樣,其中是否有任何消息? 您可能需要調整隊列上的屬性(右鍵單擊>屬性>安全性)。 如果您處於開發環境中,則可以先授予“所有人”完全控制權。 工作正常后,嘗試找出最小權限集。 您可能還想從計算機管理mmc創建隊列,而不是從代碼中創建隊列。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.