I am using message queues in C# asp.net 1.1. I create a public message queue and on subsequent execution of the code, I check if the queue exists. If it does, I don't want to create it again. The queue gets created successfully, but the problem is MessageQueue.Exists method or GetPublicQueuesByMachine method can't find this queue once it is created, so the control goes to the 'create' statement again and it fails by giving this error:
System.Messaging.MessageQueueException: Queue with the specified path name is already registered in the DS.
The GetPublicQueuesByMachine method does't find this queue and gives the Unhandled Execution Error and MessageQueueException with message text as NULL.
But GetPrivateQueuesByMachine method works fine and retrieves all private queues. Another thing is, if the same code is run in a Windows Application, it works fine and retrieves the public queue.
So why does it not find the PUBLIC queue in a WEB application? here is my code. Please help.
if (!MessageQueue.Exists(".\\requestq")) //???
MessageQueue requestq = MessageQueue.Create(".\\requestq");
MessageQueue mqlist = null;
mqlist = MessageQueue.GetPublicQueuesByMachine("."); //???
catch (MessageQueueException ex)
string mesg = ex.Message;