ASP.NET Core background tasks

To write tasks which runs in background, I always used Windows Task Scheduler or Windows Service. But ASP.NET Core is now more cross platform and these solutions are only for Windows. So recently I found a more cross platform solution which is ASP.NET Core background tasks.

Implement background tasks in microservices with IHostedService and the BackgroundService class | Microsoft Docs

Created some app with this.

GitHub – Arnab-Developer/api-health-check: Api health check app.

GitHub – Arnab-Developer/find-duplicate-bookings: Demo .NET background task application

For hosting I have below options.

  • I can use a VM and deploy my app as a self contained application in a folder. Run the exe file in it.
  • I can use a VM and install .NET 5 runtime just to run a console application. Deploy my application in a folder. I can open a terminal and use dotnet myapp.dll to run it.
  • I can put the app in a container and deploy in azure container instance or app service or kubernetes. I can put the container image in Docker Hub or Azure Container registry.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s