I have attempted to create a background processing structure using the recommended IHostedService interface in ASP.NET 2.1. I register the service
IHostedService
This is just a slight modification to the answer by @AgentFire. This method is clearer and allows for several background hosted services in a single Web Service.
services.AddSingleton(); services.AddHostedService(p => p.GetRequiredService());