Friday, March 6, 2015

The requested content appears to be script and will not be served by the static file handler – WCF IIS Hosting error

This is one of the most confusing error you get while hosting WCF service in IIS. Solution is simple but the error description completely misleads you to think in all the direction.
Below is the exact error,

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.

image

The reason for the error is when you host a WCF service which is developed in .NET Framework 4.0 or 4.5 then while deploying by default IIS select .NET Framework 2.0.

In order to resolve this issue go to IIS and change the .NET Framework to the version which was used to develop your WCF service.
The exact step would be,

Press Start button  + R  and then type inetmgr.

Expand your server and then click on Application Pools

In the list of application pools select the application pool which is being used by your new WCF service.

Here you would have already noticed the wrong framework associated with your WCF service.

Just double click on the WCF Service name and change the .NET Framework version.

image
Click OK to save the changes. Now you browse your WCF service all your issues with your WCF service hosting error would have resolved.

No comments: