Tutorial :Can I host a WCF service with NetMsmqBinding in root “/” application of an IIS7 site?



Question:

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?


Solution:1

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.


Solution:2

Hosting of WAS Activated Services do work rooted. I'm not 100% sure about the netMsmqBinding. the end point would need to be http://localhost/service.svc not /private though.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »