<PackageReference Include="Microsoft.Extensions.Hosting" Version="11.0.0-preview.2.26159.112" />

Microsoft.Extensions.Hosting.Internal.ApplicationLifetime

public class ApplicationLifetime : IApplicationLifetime, IHostApplicationLifetime
Allows consumers to perform cleanup during a graceful shutdown.

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

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.

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.

public ApplicationLifetime(ILogger<ApplicationLifetime> logger)

Initializes an ApplicationLifetime instance using the specified logger.

public void NotifyStarted()

Signals the ApplicationStarted event and blocks until it completes.

public void NotifyStopped()

Signals the ApplicationStopped event and blocks until it completes.

public void StopApplication()

Signals the ApplicationStopping event and blocks until it completes.