Queue name problems for remote private MSMQ in different domain

Topics: Logging Application Block
Oct 25, 2007 at 3:18 PM
I am using MSMQ with the distribution service to handle asynchronous messaging with transactions to handle my audit data. Everything was working fine when I was using local queues. I then tried writting my messages to a remote queue on a server in a different domain. Oh, the joy...

The documentation ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref9/html/P_System_Messaging_MessageQueue_Path.htm states that the path is of the form:


but I could not get this to work, so I tried using the MessageQueue.Exists(<queue name>) method directly and went through various iterations of that. Finally, I called the GetPrivateQueuesByMachine(<machine name>) method, which returned my full queue name, which was actually of the form:

FormatName:DIRECT=OS:<server>\private$\<queue name>

So, ok, I them pumped this back into the MessageQueue.Exists method only to be told that it's not possible to determine if the queue exists or not!!! Turns out that AD is used to discover if the queue is there. Since I am not using AD, bang!

However, there is an alternative, create a new instance of MessageQueue and test myMessageQueue.CanWrite, which then returned true. I then put the queue name into my logging application block configuration and hey presto, I now have distributed MSMQ logging.