If you are changing the .Net Framework version of a website hosted in IIS you will most likely receive a message that looks like the following
The problem is that if you restart the W3SVC, all the application pools will be recycled. In my case we are hosting multiple versions of the site in IIS (Live, Staging, etc.). I didn’t want to recycle every application pool if I didn’t need to. Plus, if you are storing state information in the worker process it will be lost when the application pool gets recycled.
The dialog points to a command you can run in order to keep the W3SVC process from restarting. The command is pretty straight forward except for the “IIS-Virtual-Path” part. The “IIS-Virtual-Path” is the path IIS uses in order to differentiate between sites. This path is in the form “W3SVC/Site ID/root”. To find the Site ID, just click on the “Web Sites” folder in IIS and you should see a table in the right column that looks similar to this:
Once you find the Site ID, open up a command prompt window and navigate to the folder of the framework version you are wanting to change to. The framework version folders are usually found in c:/Windows/Microsoft.Net/Framework/. Once you are inside the folder you can just run the following command for a site with the ID 1957079098:
aspnet_regiis.exe -norestart -s W3SVC/1957079098/root/
After you update the framework version, you will still need to restart the application pool for the website that you are changing though.