Share via


ApplicationPoolRecycling.PeriodicRestart Property

Definition

Gets the settings for application pool recycling.

public:
 property Microsoft::Web::Administration::ApplicationPoolPeriodicRestart ^ PeriodicRestart { Microsoft::Web::Administration::ApplicationPoolPeriodicRestart ^ get(); };
public Microsoft.Web.Administration.ApplicationPoolPeriodicRestart PeriodicRestart { get; }
member this.PeriodicRestart : Microsoft.Web.Administration.ApplicationPoolPeriodicRestart
Public ReadOnly Property PeriodicRestart As ApplicationPoolPeriodicRestart

Property Value

An ApplicationPoolPeriodicRestart object that can be used to conditionally restart application pools.

Examples

The following example displays the value of the PeriodicRestart property and then sets the property to 5 minutes. This code example is part of a larger example provided for the ApplicationPoolRecycling class.

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

Remarks

Application pools can be conditionally restarted based on limits of virtual memory, private memory, the number of requests, or time periods. Application pools can also be periodically restarted at any number of scheduled times. The object returned by this property provides access to configure all conditional and periodic application pool restarts.

Applies to