Proper way to register HostedService in ASP.NET Core. AddHostedService vs AddSingleton

Update In the past, a HostedService was a long-lived transient, effectively acting as a singleton. Since .NET Core 3.1 it’s an actual Singleton. Use AddHostedService A hosted service is more than just a singleton service. The runtime “knows” about it, can tell it to start by calling StartAsync or stop by calling StopAsync() whenever eg … Read more