Share via


ApplicationPoolDefaults Class

Definition

Configures default values for all application pools on a Web server.

public ref class ApplicationPoolDefaults sealed : Microsoft::Web::Administration::ConfigurationElement
public sealed class ApplicationPoolDefaults : Microsoft.Web.Administration.ConfigurationElement
type ApplicationPoolDefaults = class
    inherit ConfigurationElement
Public NotInheritable Class ApplicationPoolDefaults
Inherits ConfigurationElement
Inheritance
ApplicationPoolDefaults

Examples

The following example displays a few of the application pool default values, modifies three properties from the original default values, and creates and commits a new application pool.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    class ApplicationPoolDefaults
    {
        public void GetApplicationPoolDefaults()
        {
            ServerManager manager = new ServerManager();
            // Get the application pool defaults.
            Console.WriteLine("AutoStart:\t{0}",
                manager.ApplicationPoolDefaults.AutoStart.ToString());
            Console.WriteLine("Cpu.Limit:\t{0}",
                manager.ApplicationPoolDefaults.Cpu.Limit.ToString());
            Console.WriteLine("   Action:\t{0}",
                manager.ApplicationPoolDefaults.Cpu.Action.ToString());
            Console.WriteLine("Enable32BitAppOnWin64:\t{0}",
                manager.ApplicationPoolDefaults.Enable32BitAppOnWin64.ToString());
            Console.WriteLine("Failure.RapidFailProtection:\t{0}",
                manager.ApplicationPoolDefaults.Failure.RapidFailProtection.ToString());
            Console.WriteLine("   RapidFailProtectionInterval:\t{0}",
                manager.ApplicationPoolDefaults.Failure.RapidFailProtectionInterval.ToString());
            Console.WriteLine("ManagedPipelineMode:\t{0}",
                manager.ApplicationPoolDefaults.ManagedPipelineMode.ToString());
            Console.WriteLine("ManagedRuntimeVersion:\t{0}",
                manager.ApplicationPoolDefaults.ManagedRuntimeVersion.ToString());
            Console.WriteLine("ProcessModel.IdentityType:\t{0}",
                manager.ApplicationPoolDefaults.ProcessModel.IdentityType.ToString());
            Console.WriteLine("ProcessModel.Password:\t{0}",
                manager.ApplicationPoolDefaults.ProcessModel.Password.ToString());
            Console.WriteLine("QueueLength:\t{0}",
                manager.ApplicationPoolDefaults.QueueLength.ToString());
            Console.WriteLine("PeriodicRestart.Memory:\t{0}",
                manager.ApplicationPoolDefaults.Recycling.PeriodicRestart.Memory.ToString());
            Console.WriteLine("   Time:\t\t\t{0}",
                manager.ApplicationPoolDefaults.Recycling.PeriodicRestart.Time.ToString());
            // Set default properties for any new application pools.
            manager.ApplicationPoolDefaults.AutoStart = false;
            manager.ApplicationPoolDefaults.Cpu.Limit = 26;
            manager.ApplicationPoolDefaults.Recycling.PeriodicRestart.Time = TimeSpan.FromMinutes(1000);
            // Create a new application pool.
            ApplicationPoolCollection applicationPoolCollection = manager.ApplicationPools;
            applicationPoolCollection.Add("new app pool");
            // Commit the changes to ApplicationHost.config file.
            manager.CommitChanges();
        }
    }
}

Remarks

This class represents application pool default settings in the IIS configuration system. The properties correspond to the attributes and elements of the applicationPoolDefaults element for the applicationPools element.

When an application pool is created, the values of the ApplicationPoolDefaults class are invoked. If any of the property values of this class are modified, you must call the CommitChanges method to persist the values to the ApplicationHost.config file and to IIS Manager.

Individual application pool settings can override the defaults defined in this class.

Properties

Attributes

Gets a configuration attribute collection that contains the list of attributes for this element.

(Inherited from ConfigurationElement)
AutoStart

Gets or sets a value indicating whether the application pool is automatically started when IIS is started.

ChildElements

Gets all the child elements of the current element.

(Inherited from ConfigurationElement)
Cpu

Gets CPU usage parameters for the application pool.

ElementTagName (Inherited from ConfigurationElement)
Enable32BitAppOnWin64

Gets or sets a value indicating whether to allow 32-bit applications to run on a computer that has a 64-bit processor.

Failure

Gets actions to take when an application pool fails.

IsLocallyStored

Gets a value indicating whether the configuration element is stored in a particular configuration file.

(Inherited from ConfigurationElement)
Item[String]

Gets or sets an attribute with the specified name.

(Inherited from ConfigurationElement)
ManagedPipelineMode

Gets or sets a value that indicates the request-processing pipeline mode of managed applications in the application pool.

ManagedRuntimeVersion

Gets or sets the version of the .NET Framework that is used for managed applications in the application pool.

Methods

Gets a collection of methods for the configuration element.

(Inherited from ConfigurationElement)
ProcessModel

Gets the process management attributes for an application pool.

QueueLength

Gets or sets the maximum number of requests to queue for an application pool before requests are rejected.

RawAttributes (Inherited from ConfigurationElement)
Recycling

Gets recycling settings for the application pool.

Schema

Gets the schema for the current element.

(Inherited from ConfigurationElement)
StartMode

Methods

Delete() (Inherited from ConfigurationElement)
GetAttribute(String)

Returns a ConfigurationAttribute object that represents the requested attribute.

(Inherited from ConfigurationElement)
GetAttributeValue(String)

Returns the value of the specified attribute.

(Inherited from ConfigurationElement)
GetChildElement(String, Type)

Returns a child element that is under the current configuration element and has the specified name and type.

(Inherited from ConfigurationElement)
GetChildElement(String)

Returns a child element that is under the current configuration element and has the specified name.

(Inherited from ConfigurationElement)
GetCollection()

Returns the default collection for the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(String, Type)

Returns the configuration element that has the specified name and type and is under the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(String)

Returns all configuration elements that belong to the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(Type)

Returns the configuration element that has the specified type and is under the current configuration element.

(Inherited from ConfigurationElement)
GetMetadata(String)

Returns metadata values from the element schema.

(Inherited from ConfigurationElement)
SetAttributeValue(String, Object)

Sets the value of the specified attribute.

(Inherited from ConfigurationElement)
SetMetadata(String, Object)

Sets metadata values from the element schema.

(Inherited from ConfigurationElement)

Applies to

See also