I was setting up a new Web Server that had been pre-installed with Windows 2003, IIS 6 and ASP.NET 2.0. The catch was that when I set up a new Web site on the server, I would get a 404 error page when the server was asked to serve up ASP.NET files (aka: files with the .aspx extension). Other files such as standard .html and .asp would render without problems.
I was a bit mystified until I realized that the setup of the pre-installed version of ASP.NET 2.0 on the server likely was done before IIS setup. Thus, although IIS showed ASP.NET 2.0 as an option, ASP.NET wasn’t properly registered with IIS.
At that point all one can do is to either:
- Uninstall & re-install ASP.NET
- Register ASP.NET with IIS using the command line tool aspnet_regiis.exe
I chose to go the command line registration route using the aspnet_regiis.exe tool. As expected this solved the 404 error issue and I was able to finish setting up my sites on the new server.
Using the Aspnet_Regiis.exe Tool
For example, to register ASP.NET 2.0:
- Click the start menu and type cmd in the editable text area.
- You should see a DOS command prompt.
- Navigate in your DOS command prompt to your ASP.NET framework folder. In my case this was located at:
- At this point you can call the command line tool to register ASP.NET with IIS using the syntax:
aspnet_regiis.exe -i -enable
You will, of course, need to repeat these steps for any other versions of ASP.NET that have not been properly registered on your server.
Here are some related articles that I have written on the topic:
- IIS6 – Change the ASP.NET Version Without Restarting the W3SVC Service Using Aspnet_regiis.exe
- IIS 7: Configure a New Web Site for ASP.NET 2.0 and Windows Integrated Authentication
- IIS 7 on Windows 7: Setup Steps to get IIS Running ASP.NET Files