Chapter 7: Using IHostedService and BackgroundService

This seventh 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 7.1 – ASP.NET Core architecture

Figure 7.1 – ASP.NET Core architecture

Technical requirements

To follow the descriptions ...

Get Customizing ASP.NET Core 6.0 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.