IHostedLifecycleService Interface

Definição

Define métodos que são executados antes ou depois StartAsync(CancellationToken) de .StopAsync(CancellationToken)

public interface class IHostedLifecycleService : Microsoft::Extensions::Hosting::IHostedService
public interface IHostedLifecycleService : Microsoft.Extensions.Hosting.IHostedService
type IHostedLifecycleService = interface
    interface IHostedService
Public Interface IHostedLifecycleService
Implements IHostedService
Implementações

Métodos

Name Descrição
StartAsync(CancellationToken)

Ativado quando o host da aplicação está pronto para iniciar o serviço.

(Herdado de IHostedService)
StartedAsync(CancellationToken)

Desencadeado após StartAsync(CancellationToken).

StartingAsync(CancellationToken)

Desencadeado antes StartAsync(CancellationToken).

StopAsync(CancellationToken)

É ativado quando o anfitrião da aplicação está a realizar um desligamento suave.

(Herdado de IHostedService)
StoppedAsync(CancellationToken)

Desencadeado após StopAsync(CancellationToken).

StoppingAsync(CancellationToken)

Desencadeado antes StopAsync(CancellationToken).

Métodos da Extensão

Name Descrição
StartAndStopAsync(IHostedService, CancellationToken)

Inicia e para imediatamente o serviço.

Aplica-se a