Tuesday, January 09, 2007 2:31 PMI have two applications that uses MSMQ for duplex communication, host and client.
The host has an in-queue (Q1) where the client sends messages to the host. When a client sends a "register"-message, a new queue (Q2) is created by the host, where the client can receive answers from the host.
The procedure in the client is like this:
1. Client connects to the hosts queue, Q1.
2. Client send a register message to Q1.
3. Client waits until Q2 is created with: MessageQueue.Exists(path of Q2)
4. MessageQueue.Exists(path of Q2) returns true.
5. Client creates a MessageQueue object (MessageQueue q1 = new MessageQueue(path of Q2))
6. Client registers formatter, eventhandler for ReceiveCompletedEvent.
7. Client invokes q1.BeginReceive().
The host procedure is like follows:
1. Host listens for incoming registrations in Q1.
2. When registration is received, host creates a new queue (Q2) for that client with MessageQueue.Create(path of Q2).
The problem is that MessageQueue.Exists returns true after a while, but when Beginreceive is invoked in the client i get the following exception:
System.Messaging.MessageQueueException was unhandled
Message="The queue does not exist or you do not have sufficient permissions to perform the operation."
at System.Messaging.MessageQueue.ReceiveAsync(TimeSpan timeout, CursorHandle cursorHandle, Int32 action, AsyncCallback callback, Object stateObject)
at ApplicationServer.ApplicationServerMSMQ..ctor() in D:\WIP\src\WIP_API\AS_MSMQ\ApplicationServerMSMQ.cs:line 90
at ApplicationServer.ApplicationServerMSMQ.Main(String args) in D:\WIP\src\WIP_API\AS_MSMQ\ApplicationServerMSMQ.cs:line 121
at System.AppDomain.nExecuteAssembly(Assembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
What is wrong and what could be done to avoid it?
Wednesday, March 14, 2007 4:29 PMI have the same problem.
MessageQueue.Exists always return true for every queue name like:
Tuesday, March 20, 2007 8:36 PMYour exception seems to indicate that the client does not have receive permissions set on the queue. Does your host application grant permissions to the remote client? If the host and client apps run under different user accounts, you need to ensure that receive permissions are granted to the client. Have a look at the SetPermissions method for some examples on how to do this.