How can I tell whether a remote message queue exists? The documentation states that the “Exists” method does not work for remote machines.
The following is not valid (I know the queue path is accurate since I am able to send messages to the queue):
if (!MessageQueue.Exists(@"FormatName:Direct=TCP:192.168.2.58\Private$\MyQueue"))
throw new InvalidOperationException("Queue does not exist");
The problem is that sending a message to a network address that does not have a listening queue behind it does not cause an exception. Having an exception thrown for an invalid queue address is critical to our application.
There is an article about this:
http://blogs.msdn.com/johnbreakwell/archive/2008/07/31/checking-if-msmq-queues-exist-is-hard-work-so-should-you-bother.aspx