Wcf – host a WCF service with NetMsmqBinding in root “/” application of an IIS7 site

iisiis-7msmqwaswcf

I have created a WCF service with NetMsmqBinding, and hosted it in IIS7 using Windows Activation Service (WAS).

Current (works perfectly):

Hosted in IIS at: http://localhost/MyService/MyService.svc

With the service endpoint address: http://localhost/private/MyService/MyService.svc

And the corresponding queue: .\private$\MyService/MyService.svc

Desired (does nothing, not even an error message):

Hosted in IIS at: http://localhost/MyService.svc

With the service endpoint address: http://localhost/private/MyService.svc

And the corresponding queue: .\private$\MyService.svc

Everything works perfectly when I use the MyService IIS application. But the same setup (code, IIS security, queue security, etc.) does nothing when I try to use the root "/" app instead of the "MyService" app to host the service. I don't get any errors in the Event Log. The incoming messages just sit in the queue.

Is hosting a WAS-activated service supported in in the root application of an IIS7 site?

Best Answer

I found a bug whereby hosting WCF services in the root (spent a lot of time on the phone with MSFT Support), thus host them in an application.

For example, I have a netMsmqBinding service hosted in IIS7, it is configured for WAS and it is hosted in the default site as:

http://mymachine/msmqtest/service.svc

The queue name for MSMQ needs to be called:

"msmqtest/service.svc"

And the endpoint in the config needs to be:

net.msmq://mymachine/private/msmqtest/service.svc

Also, make sure you are using the machine name in the config, NOT a host header name or something. MSMQ works from computer to computer, very important.

Related Topic