If you change the version on the ASP.NET tab that comes with the 2.0 Framework, the entire W3SVC process restarts. If you make this type of change during a maintenance window, the impact may not be too bad, but if you have multiple application pools in IIS and need to make this type of change during the day, all the application pools will recycle.
You can avoid this problem by running the following commands. The first command configures the mappings in IIS and uses the -norestart command to tell aspnet_regiis to not restart the W3SVC service. The second command restarts the IIS Application Pool:
- %windir%\Microsoft.Net\Framework\<version>\aspnet_regiis -s <path> -norestart
- %windir%\system32\iisapp.vbs /a <app pool> -r
It's important to note that it is not supported to run both 1.1 and 2.0 framework in the same application pool. For example, you can't have /MyApp mapped to the 1.1 framework in an application pool called MyAppPool and also have /AnotherApp mapped to the 2.0 framework in the same application pool. The symptom you will see is a Server Application Unavailable message in the browser. You will also get the following event in the Application Event Log:
This requires that you know the IIS metabase path to the app; something like /w3svc/1/root/myapp if the application is under Default Web Site. You also have to know the application pool which would require you to look it up in IIS.
I've attached a .vbs file that helps to automate this process. Feel free to modify it however you see fit. It takes in the name of the web site; i.e. "Default Web Site", the version of the framework you want to map, and the virtual path to the app you want to configure. It's much easier to remember "Default Web Site" or "Intranet", than it is to remember the instance number of 578954321 🙂
Example command lines:
- Configure the Default Web Site for ASP.NET 2.0
ASPNETMapping_norestart.vbs website "Default Web Site" version 2.0
- Configure the Default Web Site for ASP.NET 1.1
ASPNETMapping_norestart.vbs website "Default Web Site" version 1.1
- Configures the /mywebapp application for ASP.NET 2.0
ASPNETMapping_norestart.vbs website "Default Web Site" apppath "/mywebapp" version 2.0
- Configures the /anotherapp application on the web site named Intranet for 2.0
ASPNETMapping_norestart.vbs website "Intranet" apppath "/anotherapp" version 2.0