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 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.