Let me confess, I had to cook this up to give you this example.
It happened to my colleague some days back when he developed a simple WCF application on Windows Server 2003 using VS2003. He selected “Target Framework 3.0” in the Property Page of that Web Site. He then deployed the application on his Win7 machine which has VS2010 with .net 4.0 installed. He fires the Web Site http://localhost/Service.svc and he gets “HTTP 404.17 – Not Found” when running the Web Site under Classic .NET AppPool.
If you run the Web Site under DefaultAppPool, we will see:
If you see “Things you can try” in the above screenshot, it says “add an explicit MIME map”. But why.
Let’s have a look at “Handler Mappings” in IIS MMC. The entry for .svc does exists.
I had referred my MSDN blog post and followed the steps to make sure I am good with the configuration.
So what’s going wrong.
I have a habit of taking FREB (Failed Request Tracing) whenever I see such issues. To my surprise IIS is initializing .net 4.0 when we request Service.svc file.
Checked Application Pools under IIS MMC
Hmm.. now that makes sense. So when you install .net 4.0 on Windows 7/Windows Server 2008, Application Pools will be configured to use .NET Framework 4.0 by default.
But, then why didn’t the Service.svc file run. If we see the Handler Mapping carefully .svc file is mapped to .net 3.0 ServiceModel.
If I change .NET Framework type of the Application Pool (Classic .NET ApplPool in our case) to v2.0. The Web Service page works fine.
To resolve the issue, there is a same old trick
Go to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and fire aspnet_regiis.exe –i.
Now look at the Handler Mappings and you will see
Fire the Web Site and it will work fine.
Hope this helps,
Vivek Kumbhar
Quote of the day:
Never believe anything until it has been officially denied. - Claud Cockburn