Chapter 5: Using IHostedService and BackgroundService

This fifth chapter isn't really about customization; it's more about a feature you can use to create background services to run tasks asynchronously inside your application. I use this feature to regularly fetch data from a remote service in a small ASP.NET Core application.

We'll examine the following topics:

  • Introducing IHostedService
  • Introducing BackgroundService
  • Implementing the new Worker Service projects

The topics of this chapter refer to the Host layer of the ASP.NET Core architecture:

Figure 5.1 – ASP.NET Core architecture

Figure 5.1 – ASP.NET Core architecture

Technical requirements

To follow the descriptions in ...

Get Customizing ASP.NET Core 5.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.