IIS7: WCF Services - .SVC do not work
Recently I came across a problem with Windows Communication Foundation Services and IIS 7.
What I did is, deploy a .SVC file to my IIS 7.
The service worked during development on the local ASP.NET Dev Webserver, but after deploying it to the server, there was an error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
The configuration section 'system.serviceModel' cannot be read because it is missing a section declaration.
Another error might be:
Unhandled Exception: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method not allowed
After some research I found the problem: WCF Services are not registered on the IIS!
To fix it, follow these steps:
- Make sure ASP.NET pages work on IIS (if not see below).
- Execute the following command with elevated privileges (as administrator):
"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i
If ASP.NET pages neither work, register ASP.NET first:
- Open a command prompt as administrator.
- Execute the follow command:
For more details see the MSDN documentation: