Wednesday, February 23, 2011

How to Change .NET Framework Version Without W3SVC Restart

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.  Not a good idea on a Production server.

Steps to resolve this issue

  1. Log onto IIS Server.
  2. Start IIS Manager.
  3. Check that your web site is a virtual directory off the Default Web Site.  If not, you need to find the Site ID of your web site. 

    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:

  4. Check that your application has an application memory pool of its own.
  5. Open a command prompt window.
  6. Change directory to .NET Framework version desired
    e.g. C:\Windows\Microsoft.NET\Framework\v4.0.30319
  7. Type aspnet_regiis –norestart –s {IIS-Virtual-Path} where:
    {IIS-Virtual-Path} = W3SVC/{web site id}/root/{application name}
    {web site ID} = “1” (for Default Website)
    {application name} = Virtual Directory of your web application
  8. Framework version will be changed. 
  9. Recycle the application memory pool for the website (from IIS Manager).