Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF MSMQ binding with an IIS service - how to instantiate the service?

I have a WCF service with netMsmqBinding. My client can send messages to my queue, and when the service is running it retrieves messages from the queue as expected. If the service is not running, messages received are queued until the service starts.

My problem is that the service does not start when a message hits the queue. The service is hosted in IIS, and so it is not instantiated until IIS receives a request. If I browse to the service then it processes the messages in the queue, but obviously this is not my desired method of processing the queue!

I expect that I need to change the service implementation, or change the IIS setup, but I do not know where or what to change.

UPDATE

Does anyone actually use MSMQ over WCF? I had this working for a short time - I enabled the binding on a different website on the same server, bizarrely - but now it has somehow stopped working again.

The only problem I am having is with the Activation of the service when there is a message in the queue. At present the queue only processes when the service is instantiated, e.g. when I browse the the .svc file. I have the net.msmq protocol enabled on the application, and I have the net.msmq binding enabled on the site... is there anything else I need to do?

like image 981
Kirk Broadhurst Avatar asked Sep 09 '09 12:09

Kirk Broadhurst


3 Answers

You explicitly need to configure IIS for non HTTP activation. I don't know all the details of the top of my head but basically you need to use appcmd to configure and enable the net.msmq binding activation.

Check this blogpost or this screencast should give you all the details.

like image 120
Maurice Avatar answered Nov 11 '22 23:11

Maurice


This might save somebody the hours it took me: http://msdn.microsoft.com/en-us/library/ms731053.aspx

like image 41
B Labovitch Avatar answered Nov 11 '22 23:11

B Labovitch


I believe that my problems using MSMQ binding over WCF were mainly around IIS.

I had no end of problems using Windows XP / Server 2003 with IIS 6.

Using Windows 7 or Server 2008 with IIS 7.5 everything works well.

An even better suggestion is to run MSMQ as a managed service / Windows Service or a stand-alone application rather than under IIS.

like image 44
Kirk Broadhurst Avatar answered Nov 11 '22 22:11

Kirk Broadhurst