ApplicationLifetime Class

Definition

Allows consumers to perform cleanup during a graceful shutdown.

public ref class ApplicationLifetime : Microsoft::Extensions::Hosting::IApplicationLifetime, Microsoft::Extensions::Hosting::IHostApplicationLifetime
public class ApplicationLifetime : Microsoft.Extensions.Hosting.IApplicationLifetime, Microsoft.Extensions.Hosting.IHostApplicationLifetime
type ApplicationLifetime = class
    interface IApplicationLifetime
    interface IHostApplicationLifetime
Public Class ApplicationLifetime
Implements IApplicationLifetime, IHostApplicationLifetime
Inheritance
ApplicationLifetime
Implements

Remarks

This API supports the .NET infrastructure and is not intended to be used directly from your code.

Constructors

ApplicationLifetime(ILogger<ApplicationLifetime>)

Initializes an ApplicationLifetime instance using the specified logger.

Properties

ApplicationStarted

Gets a cancellation token. Triggered when the application host has fully started and is about to wait for a graceful shutdown.

ApplicationStopped

Gets a cancellation token. Triggered when the application host is performing a graceful shutdown. All requests should be complete at this point. Shutdown will block until this event completes.

ApplicationStopping

Gets a cancellation token. Triggered when the application host is performing a graceful shutdown. Request might still be in flight. Shutdown will block until this event completes.

Methods

NotifyStarted()

Signals the ApplicationStarted event and blocks until it completes.

NotifyStopped()

Signals the ApplicationStopped event and blocks until it completes.

StopApplication()

Signals the ApplicationStopping event and blocks until it completes.

Applies to