IApplicationLifetime Interface

Allows consumers to perform cleanup during a graceful shutdown.

Namespace
Microsoft.AspNetCore.Hosting
Assemblies
  • Microsoft.AspNetCore.Hosting.Abstractions

Syntax

public interface IApplicationLifetime
interface Microsoft.AspNetCore.Hosting.IApplicationLifetime

Properties

Microsoft.AspNetCore.Hosting.IApplicationLifetime.ApplicationStarted

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

Return type:System.Threading.CancellationToken
CancellationToken ApplicationStarted { get; }
Microsoft.AspNetCore.Hosting.IApplicationLifetime.ApplicationStopped

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.

Return type:System.Threading.CancellationToken
CancellationToken ApplicationStopped { get; }
Microsoft.AspNetCore.Hosting.IApplicationLifetime.ApplicationStopping

Triggered when the application host is performing a graceful shutdown. Requests may still be in flight. Shutdown will block until this event completes.

Return type:System.Threading.CancellationToken
CancellationToken ApplicationStopping { get; }

Methods

StopApplication()

Requests termination the current application.

void StopApplication()