WCF MSMQ binding with an IIS service – how to instantiate the service

iismsmqmsmq-wcfwcf

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?

Best Answer

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.

Related Topic