Worker Services in .NET Core (Background Services)

preview_player
Показать описание
Background tasks with hosted services in ASP.NET Core. In ASP.NET Core, background tasks can be implemented as hosted services. A hosted service is a class with background task logic that implements the IHostedService interface. BackgroundService is a base class for implementing a long running IHostedService.

Chapter Markers
00:00 Introduction
00:57 What is a Hosted Service
04:02 Starting with the code - Creating yout first Worker Service
04:41 Inroducing the Project Template and the parts an pirces
07:45 Explanation of the StartAsync, ExecuteAsync and StopAsync methods
11:40 Building our own Background service by Implementing IHostedService
22:37 Things to think about when deciding to use Worker Services
26:22 Building a RabbitMQ Subscriber Worker Service
42:52 Converting a Worker Service to a Windows Service
46:38 Registering the Worker Service as a Windows Service
52:45 Adding the Worker Service to an ASP.NET Core application
53:17 Stopping and Deleting the Windows Service
53:50 Adding an ASP.NET Core Web API project to the Solution
54:20 Registering and Testing the Worker Service

The source code for solution presented in this video can be found here:
Рекомендации по теме
Комментарии
Автор

Damn. I'm using a pretty bassy headphone. Your voice goes into my soul. haha. Nice video btw.

JonMartins
Автор

It's a nice explanation of background services with easy code examples and how to use them in different types of .NetCore application. I appreciate you!

aamirpare
Автор

Thank you Shiv. One of the best videos for background service. Keep on publishing more videos

arunthomas
Автор

This was a fantastic resource for understanding Worker Services. I learned so much from this. I probably watched it 3 or 4 times, and keep going back to reference specific parts. I used it with Azure Service Bus, and it works perfectly. Excellent work sir! Now I need to go see what other content you have. I love your presentation style. Very casual, yet personal and very informative. I appreciated it.

nickrobitsch
Автор

Thank you for this fantastic content, Shiv! You really make this look so easy. Well done!

cliveharding
Автор

Amazing tutorial. Thanks for making this

shortcircuitza
Автор

This video is tremendously helpful. Thank you for explaining it so well, you're awesome.

alexmak
Автор

Your presentation os worth watching no doubt … subscribed

manjinderbajwa
Автор

Awesome! It gives me way to handle my task.

LordOfTheUniverseAndSpace
Автор

You got a new subscriber!! Really good video. Explained to the point. No more No less. Just perfect. Thanks a lot shiv

murthyfwdmails
Автор

Great job and great explanation! Thanks

AlfredoLopez-mcds
Автор

Hi Shiv,
I really learn a lot from your videos, your in depth videos are at the par. Best one's I liked are the Code Review ones.
If you could make one video on your journey from where you started till now would be really interesting to know on how to decide or make career choices for the Freshers as well as experienced folks.

kdivyeh
Автор

Hi Shiv Kumar
I am very thankful to you, because your this video to help me to condigure the service in windows servser.
Do you have any video for, how to configure the service on Linux/ Ubuntu machine ?

Thanks

KuldeepChandel
Автор

@Shiv Kumar ...I have requirement where in I want to divide the work into two back ground services under one Applicaiton Host builder...One will fetch the data from one service and insert in db after some manuplations...Second worker service will pick the data from table and process further..Can you please suggest am I doing the correct approach or will it impact the performance...Does two seperate workers has any dependency in the execution flow or these workers will run seperately inside One Host Builder..Also is it thread safe....please guide...

manjinderbajwa
Автор

Fans request : Since we have worker service and rabbit MQ in place, will you extend solution and do a video on SAGA choreography implementation.

vvijayar
Автор

Hello @shiv kumar... Thank you for the explanation. I have a question. What happens to the previous Background Worker Service Instance when a new instance of it starts?

bprasad
Автор

Nice channel. I subscribed, Would suggest you use a pop filter like most youtubers use.

guy
Автор

Hi, how would you setup project where we have millions of records to process in queue. Should we host multiple instances of worker service, if yes then how we can ensure no 2 instances are picking same record to process from queue, and if no then what is the alternative solution?
Thank you

microtech
Автор

Topshelf vs Worker Service performance and speed comparison please ?
Which one do you #suggest Shiv ?

ShayanFiroozi
Автор

What if we want to await a method inside OnTimer. That saying, we need to make OnTimer async and returning a Task. However, Timer accepts a void returning TimerCallBack delegate. How can we achieve such thing? Also I want to pass the cancellation token to the method I am awaiting inside OnTimer.

ardavaztterterian