15
votes

I have to WCF services which use the net.msmq protocol, hosted in IIS 7. My problem is that the services do not activate when a new message appears on the queue, you have to physically browse to the services first, before they will start picking up any messages.

Is there any way to auto activate these services?

Thanks in advance for any help

Kind Regards, Brian

7
We have the same problem, I am opening a support call with Microsoft to get to the bottom of them issue. I wonder if there is a way to know the exact error or reason for why it is not activatinguser80855

7 Answers

3
votes

There's a really good three-part series on getting WCF, MSMQ and IIS up and running and playing nicely together on Tom Hollander's blog:

Maybe those will help? MSMQ hosted in IIS7 should definitely be picking up the WCF messages automatically, if everything is configured correctly.

There's a few settings that aren't set out of the box - see part 1. You may need to add and enable additional Windows features, and you could need to run the appcmd.exe tool to configure WAS (Windows Activation Server, part of IIS7) to automatically handle non-http requests.

Marc

3
votes

I know it's an old post but in case someone else come by with that problem...

If the service doesn't activate once application pool has been shutdown, it is most probably because the queue name does not match de service URI and so WAS does not know which application to activate.

So for example, if you create a Application "Services" in the default web site and have a FirstService.svc, the queue name should be private$\Services/FirstService.svc

[Edit: Queue name should contain the application name also in plural]

2
votes

This is due to the fact that WAS will not auto-active or "warm-up" when using MSMQ. The solutions are to take a look at the IIS 7 Warm Up module or have something like a load balancer ping your service(we are using an F5 device to do this). Update - here is the link for IIS 8 App Initialization

0
votes

I found that, on Windows 7 with IIS 7.5 and .NET 4.0, the NetMsmqActivator service is disabled and stopped by default. You need to enable it and start it.

Moreover, the queue must allow "Receive Message" and "Peek Message" for the account used by the application pool and for the account used by NetMsmqActivator. On a default installation, you can use IIS APPPOOL\ASP.NET v4.0 (you'll have to type it in: that's 3 'P's, take care with the spaces) and NETWORK SERVICE.

0
votes

We have been observing this problem for more than a month now in a system with these properties:

  • Mixed services, both http and msmq based hosted in WAS on IIS7.5
  • msmq protocol used: net.msmq
  • services not hosed in root web site, but in application underneath

We have been running through all the guidelines and problem solving tecniques involving: * Protocol setup on the iis and application level. * queue naming * security settings of queue, windows services and iis

But still the problem persisted. Our solution was to follow this: http://www.daczkowski.net/tag/wcf/ That is to install the appfabric onto our iis and setup the services for autostart.

The problem itself is rather hard to define fully, what we can say is only that "sometimes the service will stop processing from the queue"

0
votes

My solution is a mix off some answers here. My queue has authentication enable, so some steps may not be needed if authentication is not used.

Here is the steps i follow to put it to work, on a windows 2012:

1) Install non-http activation services WAP (https://msdn.microsoft.com/en-us/library/ms731053(v=vs.110).aspx)

2) Create queue with the same name as the IIS application, like this private$/<WCF application>/myservice.svc.

The Net.Msmq Listener Adapter service will try to match the queue and the WCF application name in IIS as pointed by VdesmedT.

3) Enable protocols on site and application.

First create the binding:

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='808:*']

Site bindings should look like this: enter image description here

Then enable the protocol net.msmq for the site

%windir%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].[path='/'].enabledProtocols":"http,net.msmq" /commit:apphost

This command will rewrite protocols, so if you have more than http enable, you need to add it to the command line.

At Advanced Settins you should see this:

enter image description here

And finally enable the protocol net.msmq for the application.

%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/" /enabledProtocols:http,net.tcp

The Advanced Settings screen for the application should show the same thing that appears on Advanced Settings for the site, at the enabled protocols line.

4) Give permissions on queue for IIS application to Read, peek and delete, get properties and set properties. The default account is IIS Apppool\DefaulApp

5) Give peek permission on queue for services Net.Msmq Listener Adapter (default is Network Service)

Shouldn't need but i had to restart after changing permissions.

Checks:

  • To check if WCF is setup properly just use the browse the WCF application to activate it. Any messages in queue should be processed.

  • To check if WAS is activating the WCF application, recycle the Application pool and send a new message. If WAS works it should be process immediately.

-1
votes

Just set the application Auto-Start to 'Enabled' in the IIS