MSMQ Send message to Remote Queue

江枫思渺然 提交于 2019-12-21 09:27:40

问题


I am trying to send a message to a remote queue. My process isn't failing, but I still don't see the message on the remote queue? I would assume it would fail if it couldn't process the message?

I did notice that on my local machine the remote queue is listed in Outgoing queues, but don't see messages there either. Very ignorant here and all examples show that how I am doing (or so I assume) is correct.

Code (Simple for test):

    using (var transaction = new TransactionScope())
    {
        using (var queue = new MessageQueue(@"FormatName:DIRECT=OS:mymachine\MyQueueQueue"))
        {
            XDocument xdoc = XDocument.Parse("<root/>");

                 var message = new Message(xdoc.ToString());
                queue.Send(message, MessageQueueTransactionType.Single);
        }

        transaction.Complete();
    }

    Console.Read();
}

What I am doing wrong? Strange...no errors, but don't see message anywhere. Write works to my local queue.


回答1:


The queue you see on your local machine is how MSMQ transmits a message from your machine to the remote machine. So don't worry about that as long as there are no messages on it. If there were messages on it that would indicate the remote queue was not available for some reason.

Likely permissions could an issue. Check the send permissions on the remote queue. If the call is going cross-domain you will need to add ANONYMOUS LOGON to your permissions.

Also try to enable to MSMQ event log (if you are running server 2008 or above).

UPDATE

It looks like you are calling a public queue address. You should be using private queues. The address is the same except for the PRIVATE$ directive:

FormatName:DIRECT=OS:mymachine\PRIVATE$\MyQueueQueue

ALSO: is your queue name myQueueQueue like in your queue address?



来源:https://stackoverflow.com/questions/8900401/msmq-send-message-to-remote-queue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!