Sometime back my friend had a weird issue on his machine. He was working on his WCF application and as per his requirement he ran some command which brought his IIS down.
So, to resolve the issue he reinstalled IIS and now his WCF application won’t work.
Here is the scenario:
I am using Win 7 RC for our test; his was a Windows Vista box. I have IIS installed and have Microsoft .NET Framework 3.5.1 enabled, here’s the screenshot
I created a simple WCF page such that it proves WCF is working on the machine.
Now, let’s uninstall IIS. Look at the prompt here
The prompt says it will turn off the Windows Communication Foundation HTTP Activation.
On Windows Server 2008, it will prompt you something like this
On Windows Server 2008 R2 RC1, it shows like this
IIS is uninstalled.
Check the inetsrv folder and you will find few files and the applicationHost.config remaining
Now, I reinstall IIS again and this time not selecting the WCF HTTP Activation because many of the times we will miss this option.
Start IIS Manager -> Expand Sites and this is what I see
All my other websites have Binding missing.
This is because the old applicationHost.config had the configuration information and when we uninstalled IIS, the skeleton of the new websites stayed. Hence we can see the websites but the configuration missing.
I added the Bindings manually and now the websites are looking good.
Let’s look at the original issue. I will browse the WCF application and it fails
I really love IIS 7 for all the good things. The error is self-explanatory and it clearly says the handler or the MIME mapping is missing.
The error code 0x80070032 means “The request is not supported”. IIS does not know what the file Service.svc is.
Open applicationHost.config and search for .svc and it returns with nothing.
Open, command prompt and go to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>
Run the command ServiceModelReg.exe –i
This command acts similar to what aspnet_regiis.exe –i does. ServiceModelReg.exe –i will install Windows Communication Foundation and update scriptmaps at the Metabase root i.e. in the applicationHost.config.
Open applicationHost.config and now look for .svc
You will find the following handler mappings
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="svc-ISAPI-2.0-64" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
Browse the page again and now Service.svc executed fine.
Thanks! This really helps me solve a stupid Vista vs. WCF vs. IIS7.0 vs. VS2008 issue.