Problem Hosting WCF Service in IIS 7.5
For a change, we thought of blogging about problems while developing applications. In this particular blog post, we have presented details about a problem we faced while creating a WCF service application in Visual Studio 2010 and the methods we adopted to tackle the problem without issues.
Here’s our head-on with the problem:
Problem Statement: Our requirement was to create a WCF Service application in Visual Studio 2010 (.NET Framework 4.0) and host it in Windows 7 IIS 7.5 in a local machine. While testing this service on the browser by calling its *.svc file, an error occured as stated below:
“The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map in windows 7”
Reason: Reason is more descriptive in the error message itself. The possible reasons could be missing MIME Type and Handler Mapping.
Work Around: Though the error message was more descriptive, we first tried manually including the MIME type as .svc (Extension) – application/octet-stream (MIME Type) and browsed the *.svc file, which popped up a “Open/Save” dialog. Then, upon removing the extension and next examinig the handler mapping, it was found that handlers script “svc-Integrated-4.0” and “svc-ISAPI-4.0_32bit / svc-ISAPI-4.0_64bit” were missing.
To map handler script, do the following: Run aspnet_regiis.exe -i in Visual Studio 2010 command prompt. This file could be located in the %windir%Microsoft.NETFrameworkv4.0.30319. This will install ASP.NET 4.0 and add script maps to the Applicationhost.Config file in the IIS metabase.
Then, point out the application pool to use framework 4.0 and try browsing *.svc file. This resolves the problem.