.Net, ASP.NET, Deployment, IIS, IIS6, Web Development, Web Server

IIS6 – Change the ASP.NET Version Without Restarting the W3SVC Service Using Aspnet_regiis.exe

Changing the ASP.NET version of a Web site in IIS6 using the IIS Manager GUI requires a restart of the W3SVC service. This means that all sites on your Web server will be affected and sessions will be lost. This isn’t really desirable behavior if you are hosting more than one site on a Web Server.

Although one doesn’t often need to upgrade the ASP.NET version of a Web site, it’s important to know how to do so without affecting the remaining sites on the server.

Also, when you are creating a new Web site IIS6 doesn’t allow you to select the version of ASP.NET that you want to use. This is a problem since you must first set the site up, and IIS will default behind the scenes to an ASP.NET version of its choosing (usually the lowest version of ASP.NET you have installed on the server).

In either case of creating a brand new site, or upgrading an existing site it is important to know how to change the version of ASP.NET without needing to affect all of the sites on your Web server by restarting the W3SVC service.

So how can one update the ASP.NET version without restarting the W3SVC service?

The best way to go about upgrading the version of ASP.NET on your server is done using aspnet_regiis at a DOS command prompt.

For example let’s say we’ve just created a new Web site called WebTest in IIS6 on a Server called Test. Our default version of ASP.NET on the Test server is ASP.NET 1.1 and we want to run version ASP.NET 4. How is this done?

Get the Site Id in IIS6
Get the Site Id in IIS6
  1. In IIS6 click on the Web Sites folder in the left pane as shown in the image above
  2. Still in IIS6, make note of the unique Identifier for the Web site you have just created. This should be a numeric value. In the image above I have highlighted the unique identifier with a red box, so we see that we have to refer to the site as Id 126463560.
  3. Now open Windows explorer and navigate the folder structure to the installation of ASP.NET that you wish to upgrade the site to. For example on a Windows Server 2003 R2 machine the path to ASP.NET 4 is: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
  4. Copy the file system path so you have it in your clipboard.
  5. Open up a DOS command prompt (select Start – > Run -> and type CMD)
  6. In your DOS command prompt window type cd\ and hit the enter key to get to the root directory of your machine
  7. You should see the prompt for c:\
  8. Type cd
  9. Then right click the DOS command prompt and select Paste
  10. The text you have entered into your command prompt should read as follows:
  11. cd C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
  12. Click the enter key
  13. You now want to find out some further details on your site from the aspnet_regiis tool itself.
  14. In the DOS Command prompt type:
  15. aspnet_regiis -lk
  16. You should see some further details about the Web sites hosted on your Server including the W3SVC registration pathfor your sites and their corresponding versions. The output will look something like this:
    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk 
    W3SVC/  1.1.4322.2470 
    W3SVC/126463560/root/ 1.1.4322.2470 
    W3SVC/1292709509/root/  2.0.50727.3053
  17. Note that in the example above we are matching our TestWeb site by its unique identifier which is 126463560
  18. Also noteworthy is that your site may not appear if you have just created it and it has inherited your default ASP.NET version. This is not a problem, just remember in the following command to insert the unique id for your site into the format:
  19. To update your ASP.NET version to version 4 without a server restart takes only one more command to aspnet_regiis
  20. To recap: we are now going to call aspnet_regiis  from the ASP.NET framework 4 folder on the Web server
  21. Type in your command to update the version of ASP.NET like the following example:
    aspnet_regiis -s W3SVC/126463560/root/ -norestart
  22. Click the Enter key and you will see output along the following lines:
    C:\WINDOWS\Microsoft.NET\Framework\v4.0>aspnet_regiis -s W3SVC/126463560/root/ -norestart
    Start registering ASP.NET scriptmap (4.0) recursively at w3svc/126463560
    Finished registering ASP.NET scriptmap (4.0) recursively at w3svc/126463560/root/.

At this point the registration will have completed and you will be able to see version 4.0 of ASP.NET registered for your site rather than the default version 1.1 . As you can see this process was quite straightforward and did not involve a restart of the IIS Web service, which is crucial when running several sites on one machine.

Also noteworthy is point #18 above, which is that you may not see your site listed when you run aspnet_regiis  -lk, but this is no need to be concerned. There can be several reasons why your site may not appear, but the update command will work just fine if you use your site’s unique Id as if it had appeared in the aspnet_regiis  -s command to update your version of ASP.NET.


Here are some sites with further reading on this topic:


4 thoughts on “IIS6 – Change the ASP.NET Version Without Restarting the W3SVC Service Using Aspnet_regiis.exe”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s