Changing the ASP.NET Version of a Site Running on IIS6
June 9, 2011 3 Comments
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:
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:
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.
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:
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:
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.