IHostLifetime Interface

Definition

Tracks host lifetime.

C#
public interface IHostLifetime
Derived

Methods

StopAsync(CancellationToken)

Called from StopAsync(CancellationToken) to indicate that the host is stopping and it's time to shut down.

WaitForStartAsync(CancellationToken)

Called at the start of StartAsync(CancellationToken) which will wait until it's complete before continuing. This can be used to delay startup until signaled by an external event.

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)