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.

Fix For WCF NetMsmqBinding Not Picking Up Messages in Queue

Posted by Keith Elder | Posted in .Net, WCF, Web Services | Posted on 03-06-2009

Here’s the problem.  When hosting WCF services using the NetMsmqBinding in IIS7/WAS (Windows Activation Service) the application times out after 20 minutes.  While this isn’t the problem and is the default behavior in IIS it leads to the problem.  When the application is timed out, if a new message arrives in the queue, the WCF service remains idle.  In other words messages will just pile up in the queue (not good!). 

After contacting support about this issue I finally got back some information on how to address this issue so I’m posting it in case someone else runs into this issue.  Here is what you should do if you run into this problem.

  1. Ensure that the queue is named as virtual directory/serviceName.svc.  So if your application is at http://localhost/myTest/myTest.svc, the queue name should be myTest/myTest.svc.  We also should ensure that the WCF endpoint address reflects this queue name
  2. Both the IIS worker process (App Pool) and the Net.Msmq Listener service should use the same account, this account must also have Peek and Receive rights on the queue (but it’s better to just give it full control).  You can verify the account used by your web service by checking the account used by w3wp.exe in task manager
  3. Ensure that the Net.Msmq listener is running using an unrestricted token, the following command should work “sc sidtype netmsmqactivator unrestricted”
  4. Add a DWORD called “AllowNonauthenticatedRpc” to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\security, and set it to 1

Hope this helps someone, and if I find any other information, I’ll keep this updated.

Comments (2)

Quite inspiring,

It worked thanks puting a post on it

Thanks

Write a comment