Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

WCF NetMsmqBinding Error: The queue does not exist

Posted by Keith Elder | Posted in WCF | Posted on 14-01-2009

Hopefully me spending several minutes to write down a problem we recently ran into at work working with WCF and the NetMsmqBinding will save some of you a lot of time.  If you’ve landed on this page here is the error you might be seeing:

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.

There are a lot of things that can cause this error and it isn’t very descriptive.  Recently we were trying to deploy a service into our test environment and ran across this error. 

The issue was with the endpoint address.  Let me explain.

Let’s pretend our test server was named “wcftest”.  We had also created a host record in DNS that resolved to our application and configured our service in a virtual directory.  Let’s pretend that it was something like “http://MyApp/services/Msmq.svc”.  Here is the service configuration we were using.

   1: <service behaviorConfiguration="MyAppServiceBehavior"
   2:              name="MyAppService">
   3:                 <endpoint address="net.msmq://myapp/private/services/Msmq.svc"
   4:                  binding="netMsmqBinding" bindingConfiguration="msmqBinding" name="msmq"
   5:                  contract="IMyAppService" />
   6:                 <endpoint binding="mexHttpBinding" bindingConfiguration="" name="wsdl"
   7:                  contract="IMetadataExchange" />
   8:             </service>

First we checked to make sure we had a queue on the server named:  services/msmq.svc.   We did.

Secondly we looked at all the permissions on the queue and on the MSMQ service and everything was good. 

Because we were using the name of the host we had configured and setup in IIS we thought the endpoint address of the service was suppose to have the alias name in it (MyApp).  Turns out this was the problem.  Switching the address to the server name fixed the problem.  The change is:

net.msmq://wcftest/private/services/Msmq.svc

Thinking about it, it makes sense based on how MSMQ works (computer name to computer name).  It just isn’t something that jumped out at us instantly because the service was working on a development box, BUT, only because it was configured with the name of the machine and no alias.  Aha!

Comments (2)

Saqib,

Technically you don’t use MSMQ over the web you’ll use another protocol that is more web centric. However, it has been done before. You’ll just put your server name in there, whatever it responds as. Replace //wcftest/ with //keithelder.net/ for example.

-Keith

Hi Keith,

I dont understand how would you resolve your server name in www?
This settings “net.msmq://wcftest/private/services/Msmq.svc” wont tell where the service is located if you access over the web!!!!

Write a comment