BackgroundService Gotcha: Startup

added by DotNetKicks
5/22/2020 4:34:29 PM

368 Views

This is some behavior that I've found surprising (and others have as well): ASP.NET Core background services are started with a synchronous call. Specifically, the host will invoke IHostedService.StartAsync for all its hosted services, and BackgroundService directly invokes ExecuteAsync before returning from StartAsync . So BackgroundService assumes that its derived classes will have an asynchronous ExecuteAsync.


0 comments