I wasted a few hours tracking down an issue the other day where I couldn’t get an ASP.NET website running on a fresh install of Windows 7 and VS 2010. This website was running on my previous install, making it very frustrating. I spent a lot of time running through event log red herrings before coming across the real solution to my problem.
This problem can manifest itself in a number of ways:
- You get an error that indicates that ASPX files are mapped to a static file handler
- You have multiple versions of the framework installed, your site gives a 404, and you get errors/warnings in the eventlog along the lines of “
Unable to find schema for config section 'system.web.extensions/scripting/scriptResourceHandler'“, “Unknown attribute 'type'” where these errors come from theweb.configof the web application you’re trying to access.
There are other possibilities for these errors, but a big possibility is that particular version of the .NET framework that your application is not registered in IIS. The most common reason for this is that you install IIS after the framework is installed. Obviously the installer can’t do the business when IIS isn’t around.
Note: you can have the correct framework selected in the IIS application pool settings, and your web.config can be perfect but you may still be experiencing this error.
IIS looked right to me, but it wasn’t finding squat. You may not see the ASP section for the website if no framework version is installed, but if say, .NET 4 is configured, and the 3.5 version that comes with 7 isn’t, your 3.5 sites will mysteriously fail. What fun!
The magic application that allows you to diagnose whether this problem is affecting you is aspnet_regiis.exe. This little tool is found in the framework install folder. Importantly, and counter-intuitively, to check the status of a particular framework version, you need to run the executable that is specific to that version of the framework. For example, to check 1.1, you need to open a command prompt and change to the %windir%\Microsoft.NET\Framework\v1.1.4322 folder.
To check that the framework is installed, run the command: aspnet_regiis -lv.
To install this version of the framework, use aspnet_regiis -ir. This installs the framework version, but doesn’t change the settings of existing IIS application pools.
See the reference topic: ASP.NET IIS Registration Tool (Aspnet_regiis.exe) on MSDN for more information.
No Comments