.NetCore中的IHostedService
【5min+】后台任务的积木。.NetCore中的IHostedService-腾讯云开发者社区-腾讯云 (tencent.com)
原理
_hostedServices = Services.GetService<IEnumerable<IHostedService>>();
foreach (var hostedService in _hostedServices)
{
// Fire IHostedService.Start
await hostedService.StartAsync(combinedCancellationToken).ConfigureAwait(false);
}

浙公网安备 33010602011771号