ApplicationPoolRecycling 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
配置应用程序池的回收设置。
public ref class ApplicationPoolRecycling sealed : Microsoft::Web::Administration::ConfigurationElement
public sealed class ApplicationPoolRecycling : Microsoft.Web.Administration.ConfigurationElement
type ApplicationPoolRecycling = class
inherit ConfigurationElement
Public NotInheritable Class ApplicationPoolRecycling
Inherits ConfigurationElement
- 继承
示例
以下示例显示 对象的几个属性值 ApplicationPoolRecycling 。 属性 LogEventOnRecycle 更改为 Requests 和 Schedule,属性 Microsoft.Web.Administration.ApplicationPoolPeriodicRestart.Time 更改为 5 分钟。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;
namespace AdministrationSnippets
{
class ApplicationPoolRecycling
{
public void GetApplicationPoolRecycling()
{
ServerManager manager = new ServerManager();
// Get the application recycling property values.
Console.WriteLine("DisallowOverlappingRotation:\t{0}",
manager.ApplicationPools["DefaultAppPool"].Recycling.DisallowOverlappingRotation.ToString());
Console.WriteLine("DisallowRotationOnConfigChange:\t{0}",
manager.ApplicationPools["DefaultAppPool"].Recycling.DisallowRotationOnConfigChange.ToString());
Console.WriteLine("LogEventOnRecycle:\t{0}",
manager.ApplicationPools["DefaultAppPool"].Recycling.LogEventOnRecycle.ToString());
Console.WriteLine("PeriodicRestart.Time:\t{0}",
manager.ApplicationPools["DefaultAppPool"].Recycling.PeriodicRestart.Time);
// Change the LogEventOnRecycle and PeriodicRestart.Time properties.
manager.ApplicationPools["DefaultAppPool"].Recycling.LogEventOnRecycle = (RecyclingLogEventOnRecycle)6;
manager.ApplicationPools["DefaultAppPool"].Recycling.PeriodicRestart.Time = TimeSpan.FromMinutes(5);
// Commit the changes to ApplicationHost.config file.
manager.CommitChanges();
}
}
}
注解
除非锁定了默认的应用程序池回收设置,否则单个应用程序池设置可以替代它们。
修改对象的属性 ApplicationPoolRecycling 时,必须调用 Microsoft.Web.Administration.ServerManager.CommitChanges 方法以将值保存到 ApplicationHost.config 文件和 IIS 管理器。
属性
Attributes |
获取包含此元素的属性列表的配置属性集合。 (继承自 ConfigurationElement) |
ChildElements |
获取当前元素的所有子元素。 (继承自 ConfigurationElement) |
DisallowOverlappingRotation |
获取或设置重叠工作进程的启动行为。 |
DisallowRotationOnConfigChange |
获取或设置检测到配置更改时应用程序池中重叠的工作进程的启动行为。 |
ElementTagName |
配置应用程序池的回收设置。 (继承自 ConfigurationElement) |
IsLocallyStored |
获取一个值,该值指示配置元素是否存储在特定的配置文件中。 (继承自 ConfigurationElement) |
Item[String] |
获取或设置具有指定名称的属性。 (继承自 ConfigurationElement) |
LogEventOnRecycle |
获取或设置回收应用程序池的日志记录行为。 |
Methods |
获取配置元素的方法集合。 (继承自 ConfigurationElement) |
PeriodicRestart |
获取应用程序池回收的设置。 |
RawAttributes |
配置应用程序池的回收设置。 (继承自 ConfigurationElement) |
Schema |
获取当前元素的架构。 (继承自 ConfigurationElement) |
方法
Delete() |
配置应用程序池的回收设置。 (继承自 ConfigurationElement) |
GetAttribute(String) |
返回一个 ConfigurationAttribute 对象,该对象表示请求的属性。 (继承自 ConfigurationElement) |
GetAttributeValue(String) |
返回指定特性的值。 (继承自 ConfigurationElement) |
GetChildElement(String) |
返回当前配置元素下且具有指定名称的子元素。 (继承自 ConfigurationElement) |
GetChildElement(String, Type) |
返回一个子元素,该子元素位于当前配置元素下,具有指定的名称和类型。 (继承自 ConfigurationElement) |
GetCollection() |
返回当前配置元素的默认集合。 (继承自 ConfigurationElement) |
GetCollection(String) |
返回属于当前配置元素的所有配置元素。 (继承自 ConfigurationElement) |
GetCollection(String, Type) |
返回具有指定名称和类型的配置元素,并且位于当前配置元素下。 (继承自 ConfigurationElement) |
GetCollection(Type) |
返回具有指定类型且位于当前配置元素下的配置元素。 (继承自 ConfigurationElement) |
GetMetadata(String) |
从元素架构返回元数据值。 (继承自 ConfigurationElement) |
SetAttributeValue(String, Object) |
设置所指定特性的值。 (继承自 ConfigurationElement) |
SetMetadata(String, Object) |
设置元素架构中的元数据值。 (继承自 ConfigurationElement) |