1
votes

I have a WCF service that reads messages from MSMQ and writes messages to MSMQ. This is hosted in IIS. I have enabled net.msmq and http protocols on the WCF service in IIS. I have also given full permission on MSMQ for app pool I am running this service.

Once I have deployed this on the win server 2012 and I queue messages, WCF service does not pick up the messages. If my service name is myservice, Once I hit http://machinename/site/myservice.svc in the browser then on messages gets auto picked up.

Could you please know what is causing this behaviour.

1

1 Answers

1
votes

Your problem is that your WCF service needs to listen to a queue, but it cannot do that until IIS decides to start the application.

This happens only when IIS needs to handle an HTTP request. Once it receives the request it will start your application, which can then start listening on the queue.

The easiest way you can fix this is not to use IIS to host a queue listener. Use a windows service instead.

If you're stuck with IIS, but you're using 7.5 or above, you can configure the application pool settings to make the application start when IIS starts:

<applicationPools>
    <add name="appPool1" 
         startMode="AlwaysRunning" />
</applicationPools>

You also will need to ensure that Windows Activation Service is installed and running: https://msdn.microsoft.com/en-us/library/ms731053(v=vs.110).aspx