Error When Opening ASP.NET Site on IIS 7 Using Visual Studio 2005

Now that Windows Server 2008 is out the door, we're starting to see more customers using IIS 7. I recently worked on a case where one of our engineers was dealing with a customer using Visual Studio 2005 and IIS 7. He was encountering an error message when attempting to open his ASP.NET 2.0 application running on his local instance of IIS that displayed the following message:

The site is currently configured for use with ASP.NET 1.1 error.

When we checked the application pool in IIS, it was configured correctly for the 2.0 Framework, so what exactly is the problem here?

The problem is that Visual Studio 2005 came out prior to IIS 7. Therefore, it doesn't deal well with the way that the handler mappings work in IIS 7. As it turns out, the .aspx file extension is mapped to both the ASPNET-ISAPI-1.1-PageHandlerFactory (for 1.1) and to the PageHandlerFactory-ISAPI-2.0. When Visual Studio 2005 hits the site to check for ASP.NET, it is fooled into thinking that the site is configured for ASP.NET 1.1 by the mapping for the ASPNET-ISAPI-1.1-PageHandlerFactory.

To correct this problem, you can either click Yes to the dialog shown above (and you'll have to do that each time you open the project) or you can change the order of the handlers mapped to your application.

To change the order of the handlers, follow these steps:

  1. Select your application in the IIS Manager.
  2. Double-click on the Handler Mappings feature as shown below.

handlermappings

  1.   Click the View Ordered List link on the right side of the IIS Manager as shown below.

ordered

  1. Select the PageHandlerFactory-ISAPI-2.0 (or PageHandlerFactory-ISAPI-2.0-64 on 64-bit Windows).
  2. Click the Move Up link as shown below until the handler appears above the ASPNET-ISAPI-1.1-PageHandlerFactory handler.

movehandler

 

You should now be able to open the project without any issues.

By the way, this issue does not occur in Visual Studio 2008.

Jim