When developing web applications, you will often need to schedule and run background tasks. The IHostedService interface in ASP.Net Core provides a simple way to implement services that execute in the background. In this post we will explore how we can use this interface to implement background tasks, aka “hosted services,” in ASP.Net Core.
The IHostedService interface was introduced in ASP.Net Core 2.0. Here is a look at this interface.