Changing the ASP.NET Version of a Site Running on IIS6

If you attempt to change the ASP.NET version used by a website from the Internet Information Services (version 6)Manager, you will receive a warning message similar to the following:

Changing the Framework version requires a restart of the W3SVC service.  Alternatively, you can change the Framework version without restarting the W3SVC service by running: aspnet_regiis.exe -norestart -s IIS-Virtual-Path
Do you want to continue (this will change the Framework version and restart the W3SVC service)?

So what is the process for upgrading a site without restarting the W3SVC service and stopping all of the sites running on the server?

First, log on to the web server.

Next, open a command prompt and navigate to the folder for the framework that you wish to target, which is located within the OS folder (typically, the "Windows" folder on the C: drive).  For this example, we’ll assume you are upgrading to ASP.NET 4.  So, navigate to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319.

Run the "aspnet_regiis -lk" command to get a list of web site instances running on the server.  The results of the command will look something like the following:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  1.1.4322.2470
W3SVC/1177368573/root/  2.0.50727.3053
W3SVC/1292709509/root/  2.0.50727.3053
W3SVC/136133328/root/   2.0.50727.3053
W3SVC/147603420/root/   4.0.30319.0
W3SVC/1724783696/root/  4.0.30319.0
W3SVC/393926990/root/   2.0.50727.3053
W3SVC/436374705/root/   2.0.50727.3053
W3SVC/44648490/root/    4.0.30319.0
W3SVC/44648490/root/maps/       2.0.50727.3053
W3SVC/462046935/root/   4.0.30319.0
W3SVC/583520931/root/   4.0.30319.0
W3SVC/583520931/root/alertmsg.txt/      4.0.30319.0
W3SVC/707791973/root/   2.0.50727.3053
W3SVC/886194175/root/   2.0.50727.3053
W3SVC/95358537/root/ImageWeb/   2.0.50727.3053

Notice that each line lists a web site instance name and the version of ASP.NET used by that instance.  (The highlighted line in the example output represents the site we will be upgrading.)

Open the Internet Information Services Manager on the server and select the "Web Sites" node, as shown here.

IISMgr 

Find the site you want to upgrade in the right-hand pane of the IIS Manager and note the value in the "Identifier" column.  Match that value to the instance names returned by the "aspnet_regiis -lk" command.  In our example, we are going to upgrade the site with an identifier value of "136133328", which we can see in the aspnet_regiis output has an instance name of "W3SVC/136133328/root/".

Run the "aspnet_regiis" command with the "-s" and "-norestart" arguments, as shown here:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -s W3SVC/136133328/root/ -norestart
Start registering ASP.NET (4.0.30319) recursively at W3SVC/136133328/root/.
Finished registering ASP.NET (4.0.30319) recursively at W3SVC/136133328/root/.

Once this command completes, use the IIS Manager to recycle the application pool for the site. 

The site has now been upgraded.

You can now re-run the "aspnet_iis -lk" command to verify that the ASP.NET version has changed.  For example:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  1.1.4322.2470
W3SVC/1177368573/root/  2.0.50727.3053
W3SVC/1292709509/root/  2.0.50727.3053
W3SVC/136133328/root/   4.0.30319.0
W3SVC/147603420/root/   4.0.30319.0
W3SVC/1724783696/root/  4.0.30319.0
W3SVC/393926990/root/   2.0.50727.3053
W3SVC/436374705/root/   2.0.50727.3053
W3SVC/44648490/root/    4.0.30319.0
W3SVC/44648490/root/maps/       2.0.50727.3053
W3SVC/462046935/root/   4.0.30319.0
W3SVC/583520931/root/   4.0.30319.0
W3SVC/583520931/root/alertmsg.txt/      4.0.30319.0
W3SVC/707791973/root/   2.0.50727.3053
W3SVC/886194175/root/   2.0.50727.3053
W3SVC/95358537/root/ImageWeb/   2.0.50727.3053

Notice that the ASP.NET version associated with the upgraded site has changed from 2.0.50727.3053 to 4.0.30319.0.

IMPORTANT:  I think this should go without saying, but I’ll mention it just in case.  Make sure that you have made all of the necessary changes to your application and/or your application’s configuration to ensure that it will run correctly on the newly-selected version of ASP.NET.

Advertisements

3 Responses to Changing the ASP.NET Version of a Site Running on IIS6

  1. Pingback: IIS6 – Change the ASP.NET Version Without Restarting the W3SVC Service Using Aspnet_regiis.exe « Justin Cooney – Programming Tips

  2. thankyou for sharing 🙂

  3. Pingback: Confluence: GlobalX Products

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: