BackgroundService.ExecuteAsync(CancellationToken) Metodo

Definizione

Questo metodo viene chiamato all'avvio dell'oggetto IHostedService. L'implementazione deve restituire un'attività che rappresenta la durata delle operazioni a esecuzione prolungata in corso.

protected:
 abstract System::Threading::Tasks::Task ^ ExecuteAsync(System::Threading::CancellationToken stoppingToken);
protected abstract System.Threading.Tasks.Task ExecuteAsync (System.Threading.CancellationToken stoppingToken);
abstract member ExecuteAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected MustOverride Function ExecuteAsync (stoppingToken As CancellationToken) As Task

Parametri

stoppingToken
CancellationToken

Oggetto attivato quando viene chiamato StopAsync(CancellationToken).

Restituisce

Oggetto Task che rappresenta le operazioni a esecuzione prolungata.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Per le linee guida per l'implementazione, vedere Servizi di lavoro in .NET.

Si applica a