Hosting non-HTTP based WCF applications in IIS7
I remember a while ago Microsoft promising that IIS7 would solve all of our "I want to use IIS to host my WCF app but I don't want to use HTTP" problems. So today I tried to host our Image Service Application (to be released in EPiServer CMS 5 R2) in IIS7 using the net.pipe protocol. Did it work out of the box? Nope.
As with a lot of stuff in Vista, hosting non-HTTP WCF applications in IIS7 is not enabled by default. So for those of you who don't want to trawl MSDN here is a list of what you need to do to get it going:
- Enable WCF Non-HTTP activation for .NET Framework 3.0. Go to Control Panel, Programs & Features, Turn Windows features on or off. Expand the Microsoft .NET Framework 3.0 node and check the "Windows Communication Foundation Non-HTTP Activation" check box.
- Enable the non-HTTP protocols for IIS7. A quick way to do this is to run the following command at the command prompt (as Administrator of course):
%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r -y
- Enable the desired protocol for the hosting web application (this assumes you have already created a new web application which uses an Application Pool running in Integrated Managed Pipeline Mode). To do this, select the web application is the IIS7 Manager Console, click on the Advanced Settings link in the right hand column menu and then enter a comma separated list of protocols in the Enabled Protocols field (e.g. http,net.pipe,net.tcp)
Now your web application is ready to host non-HTTP WCF Applications. You can use Message-Based Activation (.svc files) to access your WCF services from client application as with HTTP binding.
Here are some good articles if you want to know more:
Extend Your WCF Services Beyond HTTP With WAS
How to: Host a WCF Service in WAS
24 June 2008