Export (0) Print
Expand All

ApplicationPoolDefaults Class

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.

  NameDescription
Public propertyAttributesGets a configuration attribute collection that contains the list of attributes for this element. (Inherited from ConfigurationElement.)
Public propertyAutoStartGets or sets a value indicating whether the application pool is automatically started when IIS is started.
Public propertyChildElementsGets all the child elements of the current element. (Inherited from ConfigurationElement.)
Public propertyCpuGets CPU usage parameters for the application pool.
Public propertyElementTagNameGets the XML tag name of the current element. (Inherited from ConfigurationElement.)
Public propertyEnable32BitAppOnWin64Gets or sets a value indicating whether to allow 32-bit applications to run on a computer that has a 64-bit processor.
Public propertyFailureGets actions to take when an application pool fails.
Public propertyIsLocallyStoredGets a value indicating whether the configuration element is stored in a particular configuration file. (Inherited from ConfigurationElement.)
Public propertyItemGets or sets an attribute with the specified name. (Inherited from ConfigurationElement.)
Public propertyManagedPipelineModeGets or sets a value that indicates the request-processing pipeline mode of managed applications in the application pool.
Public propertyManagedRuntimeVersionGets or sets the version of the .NET Framework that is used for managed applications in the application pool.
Public propertyMethodsGets a collection of methods for the configuration element. (Inherited from ConfigurationElement.)
Public propertyProcessModelGets the process management attributes for an application pool.
Public propertyQueueLengthGets or sets the maximum number of requests to queue for an application pool before requests are rejected.
Public propertyRawAttributesGets the raw attribute names and values for the current configuration element. (Inherited from ConfigurationElement.)
Public propertyRecyclingGets recycling settings for the application pool.
Public propertySchemaGets the schema for the current element. (Inherited from ConfigurationElement.)
Top

  NameDescription
Public methodDelete (Inherited from ConfigurationElement.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetAttributeReturns a ConfigurationAttribute object that represents the requested attribute. (Inherited from ConfigurationElement.)
Public methodGetAttributeValueReturns the value of the specified attribute. (Inherited from ConfigurationElement.)
Public methodGetChildElement(String)Returns a child element that is under the current configuration element and has the specified name. (Inherited from ConfigurationElement.)
Public methodGetChildElement(String, Type)Returns a child element that is under the current configuration element and has the specified name and type. (Inherited from ConfigurationElement.)
Public methodGetCollection()()()()Returns the default collection for the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(String)Returns all configuration elements that belong to the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(Type)Returns the configuration element that has the specified type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(String, Type)Returns the configuration element that has the specified name and type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetMetadataReturns metadata values from the element schema. (Inherited from ConfigurationElement.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSetAttributeValueSets the value of the specified attribute. (Inherited from ConfigurationElement.)
Public methodSetMetadataSets metadata values from the element schema. (Inherited from ConfigurationElement.)
Public methodToString (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.

Community Additions

ADD
Show:
© 2014 Microsoft