How to change .NET Framework version on IIS without restarting?


If you try to change the .NET Framework version on an IIS website, it will prompt you to restart W3SVC service. In this article, I will explain how to change .NET version on IIS without restarting.

If you are here looking for the command prompt shortcut to change .NET Framework version on IIS without restarting IIS and don't want to read this full article, here is the format:







C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -s w3svc/881126637/root -
norestart


881126637 is the Meta ID of your website site. To learn more about this, read further.

When it is time to upgrade your website to a newer version of .NET, it is pretty straight forward to do it through the IIS Manager UI. However, the frustrating part is, it will restart the W3SVC service when you change the IIS version.

However, Microsoft has been nice to give us a warning that it is going to restart it and all your websites running on IIS will be down for few minutes. I believe it wouldn't have taken much longer to program it to integrate their own suggestion to the IIS Manager :-)

This is what IIS Manager will show if you attempt to change the .NET Framework version:

Change .NET Framework version on IIS without restarting warning

Text:

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-Viirtual-Path

Do you want to continue (this will change the Framework version and
restart the W3SVC service)?



Now, Microsoft want us to go to the command prompt and type the suggested command. (I wish they had given another button there saying "click here open command command prompt!", if IIS Manager itself cannot run that command.)

The command we have to execute is pretty straight forward, but what is missing is the IIS-Virtual-Path. It took a while for me to figure out what exactly it is. I tried few times using the website name, virtual path etc, but later figured out we need to use the internal site id of the website/virtual path, which is a number

How to find IIS Site Id?


IIS 6 and older does not show the site id of the website in the UI. There are couple of ways to find site id.

You may use the aspnet_regiis -lk command will display all Site Ids, but it will not show the website name or path. So, if you have many websites, you will not be able to figure out what website each site id represent.

Another option is, right click on your website and choose the option All Tasks > Save Configuration To a File. This step will create a text file with all the meta information of the website. Open the file and look for the site id in the following format:

<IIsWebServer Location ="/LM/W3SVC/881126637"

Note down the number from the above line and use it with the aspnet_regiis command, as shown below:

aspnet_regiis -s w3svc/881126637/root -norestart


Change .NET Framework version on IIS without restarting

Remember to run the aspnet_regiis from the correct version of .NET version you want the website to be registered with.


Article by Tony John
Tony John is a professional blogger from India, who started his first Weblog in 1998 at Tripod.com. Tony switched to blogging as a passion blended business in the year 2000 and currently operates several popular web properties including IndiaStudyChannel.com, Techulator.com, dotnetspider.com and many more.

Follow Tony John or read 669 articles authored by Tony John

Related Articles

IIS App pool crashing on startup

Today I found my IIS application pool crashes on start up with the following error: The identity of application pool is invalid. The user name or password that is specified for the identity may be incorrect, or the user may not have batch logon rights. If the identity is not corrected, the application pool will be disabled when the application pool receives its first request.

More articles: IIS Server .NET Framework

Comments

Guest Author: Marco Botega06 Sep 2012

Hello Tony,

My name is Marco and I would like to ask about if this behavior is applied to an "application/virtual directory" within a web site?

I had a situation on that I changed the .Net version from 1.1 to 4.0 on an application, and, the WWW service stopped.

Could you give me some tips about how to avoid this behavior?

Guest Author: Einsten06 Sep 2012

In this resource of article, how to change .NET Framework version on IIS without restarting and How to find IIS Site Id? both the information are useful and informative.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: