WCF MSMQ binding to IIS - how to instantiate a service?

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

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

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

UPDATE

Does anyone really use MSMQ over WCF? I had this for a short time - I turned on the binding on another website on the same server, which is strange, but now it somehow stops working again.

The only problem I encountered is to activate the service when there is a message in the queue. Currently, the queue is only processed when creating a service instance, for example. when i view the .svc file. I have the net.msmq protocol included in the application and I have the net.msmq binding enabled on the site ... is there anything else I need to do?

+7
iis wcf msmq msmq-wcf
source share
4 answers

You explicitly need to configure IIS to activate without HTTP. I don’t know all the details of the top of my head, but basically you need to use appcmd to configure and activate the activation of the net.msmq binding.

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

+5
source share

This can save someone how much I needed: http://msdn.microsoft.com/en-us/library/ms731053.aspx

+3
source share

I believe that my problems with binding MSMQ to WCF were mainly around IIS.

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

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

Better yet, offer to run MSMQ as a managed Windows service / service or stand-alone application, rather than under IIS.

+2
source share

One option is to host this as a Windows service. Because IIS does not automatically activate WAS when a message is queued.
Another option is to create a simple Windows service that checks this service after a certain period of time. We set up another contract for the same service, without IsOneWay = true (since this operation will not interact with queues). Then a Windows service is created that binds the URL of the WCF service after a certain period of time, which ensures that the WAS process is always active and WCF collects messages as soon as a message appears in the queue.

Also, make sure the service is also hosted on http and net.msmq.

I came across a good article for a walkthrough on implementing WCF with MSMQ using Net.Msmq binding:
Install MSMQ Using WCF Using Net.Msmq Binding

0
source share

All Articles