IHostedService 介面

定義

針對由主機所管理的物件定義方法。

public interface class IHostedService
public interface IHostedService
type IHostedService = interface
Public Interface IHostedService
衍生

方法

StartAsync(CancellationToken)

當應用程式主機準備好啟動服務時觸發。

StopAsync(CancellationToken)

當應用程式主機執行順利關機時觸發。

擴充方法

StartAndStopAsync(IHostedService, CancellationToken)

啟動並立即停止服務。

適用於