How to: Host Web Applications That Use Different Versions of the .NET Framework on the Same Server
If you want to install a new version of the .NET Framework on a server but do not want to upgrade all the Web applications that run on the server to use that version of the framework, you can run multiple versions of the .NET Framework side-by-side.
Each ASP.NET application is configured to run under a specific version of the common language runtime (CLR). When you have multiple versions of the CLR running side-by-side on a server, you can associate each Web application with a specific CLR version.
If an IIS Web application that targets the .NET Framework 3.5 or earlier is nested inside an IIS Web application that targets the .NET Framework 4, the compiler might report errors when it compiles the nested application. This is because Web.config files inherit settings from files that are higher in the configuration file hierarchy. The .NET Framework 4 is backward compatible; therefore, a nested application that targets the .NET Framework 4 can inherit settings from Web.config files that are for earlier versions. But earlier versions of the .NET Framework are not forward compatible; therefore, they cannot inherit settings from a .NET Framework 4 Web.config file. ASP.NET 4 applications that are configured as children of applications that run earlier versions of ASP.NET also might not run. For information about how to fix this, see the section "ASP.NET 4 Child Applications Fail to Start When Under ASP.NET 2.0 or ASP.NET 3.5 Applications" in the document ASP.NET 4 Beta 2 Breaking Changes on the ASP.NET Web site.
For more information, see ASP.NET Side-by-Side Execution Overview.
You can install multiple versions of the .NET Framework on the same server. You can also uninstall a specific version of the .NET Framework.
To install a version of the .NET Framework
Run the .NET Framework redistributable package setup program (Dotnetfx.exe) for the version that you want to install.
When you install an additional version of the CLR on a server that already has an earlier version, existing ASP.NET applications are not automatically upgraded to use the newly installed version even if it is a later version. For information about how to associate an application with a specific version of the CLR, see the procedures later in this document.
For more information about how to install the .NET Framework, see .NET Framework Deployment Guide for Developers or .NET Framework Deployment Guide for Administrators.
Make sure that ASP.NET is enabled in IIS, using one of these methods:
In IIS 6.0, use the Security Lockdown Console.
In IIS 7.0, use the module in the IIS Manager that is called ISAPI and CGI Restrictions.
When the .NET Framework is installed through the Control Panel Add or Remove Programs application or the Windows Configure Your Server wizard, ASP.NET is enabled in the security lockdown console by default. However, if the .NET Framework is installed through Microsoft Visual Studio, Windows Update, or the .NET Framework redistributable package (Dotnetfx.exe), ASP.NET is disabled by default.
Transfer custom configuration settings as needed to the new Machine.config file from the current configuration file.
Each version of the CLR has its own version of the Machine.config file. When you install a new version of the CLR, custom configuration settings in the current Machine.config file are not automatically transferred to the newly installed Machine.config file.
To uninstall a version of the .NET Framework
Use the Control Panel Add or Remove Programs application to uninstall a specific version of the .NET Framework.
During the uninstall process, the setup program calls the ASP.NET IIS Registration tool (Aspnet_regiis.exe) with the -u option (uninstall flag). For more information about the -u option of the Aspnet_regiis.exe tool, see ASP.NET IIS Registration Tool (Aspnet_regiis.exe).
When you remove the last version of ASP.NET from a server, IIS will render ASP.NET pages of any remaining ASP.NET applications as literal text. This could potentially expose source code to the client.
After you install a second (or subsequent) version of the .NET Framework on a server, you can associate ASP.NET applications with specific versions of the CLR. The procedure to do this is different for IIS 7.0 and IIS 6.0.
To associate a Web application with a version of the CLR in IIS 7.0
In Windows, click Start and then click Run.
In the Run dialog box type inetmgr, and then click OK.
In the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, select the application pool that contains the application that you want to change.
In the Actions pane, click View Applications.
Select the application whose application pool you want to change and then click Change Application Pool in the Actions pane.
The Select Application Pool dialog box is displayed.
In the Application Pool list, select an application pool that is associated with the CLR that you want to run the application under, and then click OK.
If no application pool exists for the CLR version that you want, you must create a new application pool. For more information, see IIS 7.0: Managing Application Pools in IIS 7.0.
To associate a Web application with a version of the CLR in IIS 6.0
Register a scriptmap for the application in order to associate it with the CLR version that you want to run the application under.