Getting a ,NET 4 WCF service running on IIS7
Now I know this should be simple and obvious but I had a few problems today publishing a web service to a new IIS7 host. These are the steps I had to follow to get around all my errors:
- Take a patched Windows Server 2008 R2, this had the File Server and IIS roles installed.
- I install MSDeploy (http://blog.iis.net/msdeploy) onto the server to manage my deployment, this is a tool I am becoming a big fan of lately.
- Make sure the MS Deploy service has started, it doesn’t by default.
- In IIS manager
- Create a new AppPool (I needed to set it to .NET 4 for my application)
- Create a new Web Site, pointing at the new AppPool
- In Visual Studio 2010 create an MSDeploy profile to send to the new server and web site. This deployed OK
- AND THIS IS WHERE THE PROBLEMS STARTED
- When I browsed to my WCF webservice e.g.http://mysite:8080/myservice.svc whilst on the server I got a ‘500.24 Integrated Pipeline Issue’ error. This was fixed by swapping my AppPool’s pipeline mode to Classic, as I did need to use impersonation for this service.
- Next I got a ‘404.3 Not Found’ error. This was because the WCF Activation feature was not installed in the box. This is added via Server 2008 : Server Manager -> Add Features-> .Net Framework 3.x Features -> WCF Activation
- Next it was a ‘404.17 Not Found Static Handler’. If I looked in IIS Manager, Feature View, Handler Mapping I only saw mention on 2.0 versions of files. So I reran aspnet_iisreg /i from the 4.0 framework directory and both 2.0 and 4.0 versions were shown in the Handler list
- Next it was a ‘404.2 Not Found. Description: The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server’. In the IIS Manager at the server level I had to enable the .NET 4 handlers in ISAPI and CGI restriction section
- I could then get to see the WSDL for the WCF service
- And finally I had to open port 8080 on the box to allow my clients to see it.
Now that was straight forward wasn't;t it.
Read the complete post at http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2010/08/06/getting-a-net-4-wcf-service-running-on-iis7.aspx