IHostApplicationLifetime Interface

Definition

Allows consumers to be notified of application lifetime events. This interface is not intended to be user-replaceable.

C#
public interface IHostApplicationLifetime
Derived

Properties

ApplicationStarted

Gets a cancellation token. Triggered when the application host has fully started.

ApplicationStopped

Gets a cancellation token. Triggered when the application host has completed a graceful shutdown. The application will not exit until all callbacks registered on this token have completed.

ApplicationStopping

Gets a cancellation token. Triggered when the application host is starting a graceful shutdown. Shutdown will block until all callbacks registered on this token have completed.

Methods

StopApplication()

Requests termination of the current application.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)