Saturday, April 25, 2009

MSMQ in work group environment

Recently I realized that my application that was working fine on domain machine wont work on work group environment. On analyzing I found that it was because of the MSMQ that was being used by WCF to communicate. I have used Public queues which are not allowed in work group. I just changed my code to create private queue and it started working fine. I was surprised to know that the trick of making a queue public/private was in its name.
Name = machineName\QueueName - Public Queue
Name = machineName\Private$\QueueName - Public Queue

Unlike Public queue, Private queues can not be created on the remote machine.

I thought all was done and my application will start running fine with this change. However, one more hurdle was waiting its turn. The ServiceHost instantiation reported error
There was an error opening the queue. Ensure that MSMQ is installed and running, the queue exists and has proper authorization to be read from. The inner exception may contain additional information.
The Inner exception read:
An error occurred while opening the queue:The queue does not exist or you do not have sufficient permissions to perform the operation. (-1072824317, 0xc00e0003). The message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that the queue is available to open with the required access mode and authorization.

Prima-facie it looked like a permission/rights issue. I googled the error message and was suggested to try various options like creating the user with same id and password on both the machine and giving full control of the queue to the anonymous user. However, non of them worked.

Finally a trail worked. I just changed URI end point from

net.msmq://machineName/QueueName

to

net.msmq://machineName/private/QueueName

No comments:

Post a Comment