Application Pool Defaults <applicationPoolDefaults>
Overview
The <applicationPoolDefaults>
collection of the <applicationPools>
collection configures default values for all application pools on a Web server.
Note
Any default values that are not explicitly defined in the <applicationPoolDefaults>
collection will still inherit the default values in the IIS 7 and later schema, and individual application pool settings override any default values.
Compatibility
Version | Notes |
---|---|
IIS 10.0 | The <applicationInitialization> element was not modified in IIS 10.0. |
IIS 8.5 | The <applicationInitialization> element was not modified in IIS 8.5. |
IIS 8.0 | Another value ("v4.0") was added to the managedRuntimeVersion attribute in IIS 8.0, and its default value was changed to "" instead of "v2.0". |
IIS 7.5 | The <applicationPoolDefaults> element was not modified in IIS 7.5. |
IIS 7.0 | The <applicationPoolDefaults> element was introduced in IIS 7.0. |
IIS 6.0 | The <applicationPoolDefaults> element replaces portions of the IIS 6.0 IIsApplicationPools metabase property. |
Setup
The <applicationPools>
collection is included in the default installation of IIS 7 and later.
How To
How to set up application pool defaults
Open Internet Information Services (IIS) Manager:
If you are using Windows Server 2012 or Windows Server 2012 R2:
- On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
If you are using Windows 8 or Windows 8.1:
- Hold down the Windows key, press the letter X, and then click Control Panel.
- Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
If you are using Windows Server 2008 or Windows Server 2008 R2:
- On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
If you are using Windows Vista or Windows 7:
- On the taskbar, click Start, and then click Control Panel.
- Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
In the Connections pane, expand the server name, and then click Application Pools.
On the Application Pool Defaults dialog box, specify your desired options.
When you have finished specifying your settings, click OK.
Configuration
Attributes
Attribute | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
autoStart |
Optional Boolean attribute. When true, indicates to the World Wide Web Publishing Service (W3SVC) that the application pool should be automatically started when it is created or when IIS is started. The default value is true . |
||||||||
CLRConfigFile |
Optional string value. Specifies the .NET configuration file for the application pool. Note: This attribute was added in IIS 7.5. There is no default value. |
||||||||
enable32BitAppOnWin64 |
Optional Boolean attribute. When true, enables a 32-bit application to run on a computer that runs a 64-bit version of Windows. The default value is false . |
||||||||
managedPipelineMode |
Optional enum attribute. Specifies the request-processing mode that is used to process requests for managed content. The managedPipelineMode attribute can be one of the following possible values; the default is Integrated .
|
||||||||
managedRuntimeLoader |
Optional string attribute. Specifies the managed loader to use for pre-loading the application pool. Note: This attribute was added in IIS 7.5. The default value is webengine4.dll. |
||||||||
managedRuntimeVersion |
Optional string attribute. Specifies the .NET Framework version to be used by the application pool. The managedRuntimeVersion attribute can be one of the following possible values; the default value is "" .
|
||||||||
name |
Required string attribute. Specifies a unique name for an application pool on the server. |
||||||||
queueLength |
Optional uint attribute. Indicates to HTTP.sys how many requests to queue for an application pool before rejecting future requests. When the value set for this property is exceeded, IIS rejects subsequent requests with a 503 error. If the loadBalancerCapabilities setting is true, the connection is closed instead of rejecting requests with a 503. For more information about loadBalancerCapabilities, see Failure Settings for an Application Pool. The default value is 1000 . |
||||||||
startMode |
Optional enum value. Specifies the startup type for the application pool. Note: This attribute was added in IIS 7.5. The startMode attribute can be one of the following possible values; the default value is OnDemand .
|
Child Elements
Element | Description |
---|---|
cpu |
Configures CPU affinity and CPU actions. |
environmentVariables |
Configures a collection of environment variables to pass to worker processes. |
failure |
Configures actions to take when an application pool fails. |
processModel |
Configures process management attributes for an application pool. |
recycling |
Configures application pool recycling. |
Configuration Sample
The following configuration sample specifies the default identity for all application pools to be the built-in application pool identity, and specifies 200 as the default number of requests after which application pools are recycled.
<applicationPools>
<add name="DefaultAppPool" />
<applicationPoolDefaults>
<processModel identityType="ApplicationPoolIdentity" />
<recycling>
<periodicRestart requests="200" />
</recycling>
</applicationPoolDefaults>
</applicationPools>
Sample Code
The following examples configure the application pools to start automatically, to use version 2.0 of the .NET environment, and to use the integrated pipeline by default.
AppCmd.exe
appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.autoStart:"True" /commit:apphost
appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.managedRuntimeVersion:"v2.0" /commit:apphost
appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.managedPipelineMode:"Integrated" /commit:apphost
Note
You must be sure to set the commit parameter to apphost
when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample {
private static void Main() {
using(ServerManager serverManager = new ServerManager()) {
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection applicationPoolsSection = config.GetSection("system.applicationHost/applicationPools");
ConfigurationElement applicationPoolDefaultsElement = applicationPoolsSection.GetChildElement("applicationPoolDefaults");
applicationPoolDefaultsElement["autoStart"] = true;
applicationPoolDefaultsElement["managedRuntimeVersion"] = @"v2.0";
applicationPoolDefaultsElement["managedPipelineMode"] = @"Integrated";
serverManager.CommitChanges();
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Class Sample
Shared Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim applicationPoolsSection As ConfigurationSection = config.GetSection("system.applicationHost/applicationPools")
Dim applicationPoolDefaultsElement As ConfigurationElement = applicationPoolsSection.GetChildElement("applicationPoolDefaults")
applicationPoolDefaultsElement("autoStart") = True
applicationPoolDefaultsElement("managedRuntimeVersion") = "v2.0"
applicationPoolDefaultsElement("managedPipelineMode") = "Integrated"
serverManager.CommitChanges()
End Sub
End Class
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var applicationPoolsSection = adminManager.GetAdminSection("system.applicationHost/applicationPools", "MACHINE/WEBROOT/APPHOST");
var applicationPoolDefaultsElement = applicationPoolsSection.ChildElements.Item("applicationPoolDefaults");
applicationPoolDefaultsElement.Properties.Item("autoStart").Value = true;
applicationPoolDefaultsElement.Properties.Item("managedRuntimeVersion").Value = "v2.0";
applicationPoolDefaultsElement.Properties.Item("managedPipelineMode").Value = "Integrated";
adminManager.CommitChanges();
VBScript
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set applicationPoolsSection = adminManager.GetAdminSection("system.applicationHost/applicationPools", "MACHINE/WEBROOT/APPHOST")
Set applicationPoolDefaultsElement = applicationPoolsSection.ChildElements.Item("applicationPoolDefaults")
applicationPoolDefaultsElement.Properties.Item("autoStart").Value = True
applicationPoolDefaultsElement.Properties.Item("managedRuntimeVersion").Value = "v2.0"
applicationPoolDefaultsElement.Properties.Item("managedPipelineMode").Value = "Integrated"
adminManager.CommitChanges()