IIS and calling MSMQ (10/7/2006)

Dear Ali,
Reading from a private message Q works fine when I run it under inbuilt VS server2005 server,but when published on IIS server under a folder under inetpub/wwwroot the application fails throwing exception. "Access to Message Queing system is denied." Can you help?
Thanks. John PACI
Actual error log pasted below:- Wait At Q fails :Path is :FormatName:DIRECT=OS:dp-pcd-john\private$\commd_q :Access to Message Queuing system is denied.


Dear John
That is wonderful. I love these kind of errors, simply because without these errors we consultants were out of job (lol).
Ok, fun is enough. Open your IIS administration console. If you right click your ASP .NET web application you will see that on the Directory tab you have a property called Application pool. By default the Application pool is set to DefaultAppPool.

Just keep it in mind and close the properties dialog box. Now in the IIS administration console expand application pools. Then you will find the DefaultAppPool there. Hey, we are very close to the problem source now. Just right click on the default ApplicationAppPool and see the properties.

Click on the Identity tab and here is the problem. Actually your application pool tries to reach MSMQ using Network Service account when you publish the web application on IIS. With a little bit of playing with permissions you can have your ASP .NET web application with this Network Service account, but because it is a built-in windows account it can never reach out of server box resources and Public message Queue is one of them. So do it in a proper way and make the application pool Configurable and assign it an active directory account and provide access to the desired queue to that AD account.
 That will solve the problem. No doubt. Have fun and by the way, I am quite happy that I see at least some people in Kuwait are programming MSMQ.
Cheers
Alireza


By: John A Zachariah  10/8/2006
Thankyou very much Ali,your article is very informative,including all the other articles in your sites ,which are very useful. regards
URL:  
Your name:
Email:
URL:
Comments:
 

 -