This topic has not yet been rated - Rate this topic

ApplicationPoolDefaults Class

IIS 7.0

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

System..::..Object
  Microsoft.Web.Administration..::..ConfigurationElement
    Microsoft.Web.Administration..::..ApplicationPoolDefaults

Namespace:  Microsoft.Web.Administration
Assembly:  Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)
public sealed class ApplicationPoolDefaults : ConfigurationElement

The ApplicationPoolDefaults type exposes the following members.

  Name Description
Public property Attributes Gets a configuration attribute collection that contains the list of attributes for this element. (Inherited from ConfigurationElement.)
Public property AutoStart Gets or sets a value indicating whether the application pool is automatically started when IIS is started.
Public property ChildElements Gets all the child elements of the current element. (Inherited from ConfigurationElement.)
Public property Cpu Gets CPU usage parameters for the application pool.
Public property ElementTagName Gets the XML tag name of the current element. (Inherited from ConfigurationElement.)
Public property Enable32BitAppOnWin64 Gets or sets a value indicating whether to allow 32-bit applications to run on a computer that has a 64-bit processor.
Public property Failure Gets actions to take when an application pool fails.
Public property IsLocallyStored Gets a value indicating whether the configuration element is stored in a particular configuration file. (Inherited from ConfigurationElement.)
Public property Item Gets or sets an attribute with the specified name. (Inherited from ConfigurationElement.)
Public property ManagedPipelineMode Gets or sets a value that indicates the request-processing pipeline mode of managed applications in the application pool.
Public property ManagedRuntimeVersion Gets or sets the version of the .NET Framework that is used for managed applications in the application pool.
Public property Methods Gets a collection of methods for the configuration element. (Inherited from ConfigurationElement.)
Public property ProcessModel Gets the process management attributes for an application pool.
Public property QueueLength Gets or sets the maximum number of requests to queue for an application pool before requests are rejected.
Public property RawAttributes Gets the raw attribute names and values for the current configuration element. (Inherited from ConfigurationElement.)
Public property Recycling Gets recycling settings for the application pool.
Public property Schema Gets the schema for the current element. (Inherited from ConfigurationElement.)
Top
  Name Description
Public method Delete (Inherited from ConfigurationElement.)
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetAttribute Returns a ConfigurationAttribute object that represents the requested attribute. (Inherited from ConfigurationElement.)
Public method GetAttributeValue Returns the value of the specified attribute. (Inherited from ConfigurationElement.)
Public method GetChildElement(String) Returns a child element that is under the current configuration element and has the specified name. (Inherited from ConfigurationElement.)
Public method GetChildElement(String, Type) Returns a child element that is under the current configuration element and has the specified name and type. (Inherited from ConfigurationElement.)
Public method GetCollection()()()() Returns the default collection for the current configuration element. (Inherited from ConfigurationElement.)
Public method GetCollection(String) Returns all configuration elements that belong to the current configuration element. (Inherited from ConfigurationElement.)
Public method GetCollection(Type) Returns the configuration element that has the specified type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public method GetCollection(String, Type) Returns the configuration element that has the specified name and type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public method GetHashCode (Inherited from Object.)
Public method GetMetadata Returns metadata values from the element schema. (Inherited from ConfigurationElement.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method SetAttributeValue Sets the value of the specified attribute. (Inherited from ConfigurationElement.)
Public method SetMetadata Sets metadata values from the element schema. (Inherited from ConfigurationElement.)
Public method ToString (Inherited from Object.)
Top

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.

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();
        }
    }
}


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ