I have attempted to create a background processing structure using the recommended IHostedService interface in ASP.NET 2.1. I register the service
IHostedService
Current workaround from mentioned git page:
services.AddSingleton(); services.AddSingleton(p => p.GetService());
This creates your service as hosted (runs and stops at host's start and shutdown), as well as gets injected as depedency wherever you require it to be.