When attempting to get a new machine running, I have come across an issue getting IIS hosted WCF services to instantiate.
A typical WCF service file would contain something like the following:
<%@ServiceHost language=c# Debug=”true” Service=”Bellette.MyService” %>
The error is typically something like the following:
Unhandled Exception: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method not allowed.
This can occur if ASP.NET isn’t installed or the .svc file is not mapped to the aspnet_isapi.dll
To correct this first must make sure that aspnet_isapi is enabled as a Web service extension for IIS. You do this by running
aspnet_regiis –i –enable from the .NET Framework installation directory. Once you have done so, verify that ASP.NET is running. To do so, place a test .aspx file in the inetpubwwwroot directory, and make sure it can be opened in the browser.
If IIS was installed after WCF, running the following will register the required script mappings in IIS:
“%WINDIR%Microsoft.NetFrameworkv3.0Windows Communication FoundationServiceModelReg.exe” -r
More detail can be found on MSDN.