Specify a .NET Framework Version for an Application Pool (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
If your Web server hosts ASP.NET applications, you must know which version of the .NET Framework these applications use before you assign them to application pools. IIS 7 preloads the .NET Framework version that is specified for the application pool. Only one version of the .NET Framework can be loaded in an application pool. Applications in the same application pool must therefore use the same .NET Framework version; otherwise, their associated worker processes will not run.
Applications that do not use managed code or enable any managed server modules do not have this requirement. These applications can explicitly state that no version of the .NET Framework should be preloaded.
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Application Pools Feature Requirements (IIS 7).
Exceptions to Feature Requirements
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
On the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, select the application pool for which you want to specify a .NET Framework version, and then click Basic Settings in the Actions pane.
In the Edit Application Pool dialog box, in the .NET Framework version list, select the version that you want the application pool to use or select No Managed Code if the application uses only native code.
To change the .NET Framework version that an application pool runs, use the following syntax:
appcmd set apppool /apppool.name: string /managedRuntimeVersion: string
The variable apppool.namestring is the name of the application pool that you want to change. The variable managedRuntimeVersionstring is the version of the .NET Framework that you want the application pool to run. When you want to run a specific version of the .NET Framework, specify the value for managedRuntimeVersionstring as v1.0, v1.1, or v2.0, or leave the value blank if you do not want to run managed code in the application pool. For example, to configure an application pool named Marketing to use .NET Framework version 1.1, type the following at the command prompt, and then press ENTER:
appcmd set apppool /apppool.name: Marketing /managedRuntimeVersion:v1.1
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
The procedure in this topic affects the following configuration elements:
managedRuntimeVersion attribute of <add> element under <applicationPools>
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
Use the following WMI classes, methods, or properties to perform this procedure:
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.
ConceptsManaging Application Pools in IIS 7