IHost.StartAsync(CancellationToken) Methode

Definition

Startet die IHostedService für das Programm konfigurierten Objekte. Die Anwendung wird so lange ausgeführt, bis sie unterbrochen oder bis StopApplication() zum Aufruf aufgerufen wird.

public System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken = default);
abstract member StartAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function StartAsync (Optional cancellationToken As CancellationToken = Nothing) As Task

Parameter

cancellationToken
CancellationToken

Wird zum Abbrechen des Programmstarts verwendet.

Gibt zurück

Ein Task Vorgang, der IHost beim Start abgeschlossen wird.

Ausnahmen

Das Abbruchtoken wurde abgebrochen. Diese Ausnahme wird in der zurückgegebenen Aufgabe gespeichert.

Gilt für: