Introducing worker services
.NET Core worker services can be really useful every time we need to perform a repetitive or background-running operation. In more detail, they can be used in the application layer to enable asynchronous operations and handle the events of an event-based architecture. If every time you need to publish or listen for a message, you need to refresh data based on a schedule, or your application needs to queue a background work item, then you should probably use a worker service. Furthermore, with worker services, it is possible to run multiple background tasks on the same server without consuming a lot of resources.
The foundation of worker services in .NET Core is the IHostedService interface. The out-of-the-box worker ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access