404 - File or directory not found, When switching application pool to ASP.Net 4.0

This morning I was upgrading an existing ASP.Net application on Windows 2008 R2 server. Previously it was using an application pool that was using ASP.Net 2.0 framework. Since I had compiled the application with .Net 4.0 framework, I need to switch in IIS 7.5 for application to use application pool for ASP.Net 4.0. As soon as I switched to using ASP.Net 4.0 framework in application pool, I got the following error.

404 - File or directory not found.
The resource you are looking for might have been removed, 
had its name changed, or is temporarily unavailable.

That did not make sense for a moment because I was just using the web application and how can I get 404 error just by switching ASP.Net version in application pool. After digging around in Microsoft Knowledge base and IIS7 documentation, I found that the issue is related to ISAPI filter for ASP.Net 4.0 not being enabled in IIS. Here is what you need to do see what is enabled and what is not enabled for ISAPI and CGI in your server.

From IIS Manager, click on top node of your server in left pane. You will see feature view as shown in the image below.

iis7 feature view

You can see that only ISAPI filters enabled for my server are for ASP.Net 2.0. The ones for ASP.Net 4.0 are not available. Just enabled those for ASP.Net 4.0 and you should be all set to roll.

comments powered by Disqus

Search

Social

Weather

4.9 °C / 40.8 °F

weather conditions Clear

Monthly Posts

Blog Tags