Share via


IHostedLifecycleService Antarmuka

Definisi

Menentukan metode yang dijalankan sebelum atau sesudah StartAsync(CancellationToken) dan 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
Penerapan

Metode

StartAsync(CancellationToken)

Dipicu ketika host aplikasi siap untuk memulai layanan.

(Diperoleh dari IHostedService)
StartedAsync(CancellationToken)

Dipicu setelah StartAsync(CancellationToken).

StartingAsync(CancellationToken)

Dipicu sebelum StartAsync(CancellationToken).

StopAsync(CancellationToken)

Dipicu ketika host aplikasi melakukan pematian dengan baik.

(Diperoleh dari IHostedService)
StoppedAsync(CancellationToken)

Dipicu setelah StopAsync(CancellationToken).

StoppingAsync(CancellationToken)

Dipicu sebelum StopAsync(CancellationToken).

Metode Ekstensi

StartAndStopAsync(IHostedService, CancellationToken)

Memulai dan segera menghentikan layanan.

Berlaku untuk