Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run cron job every day in asp. Net core application?

I have a web application written in asp. Net mvc core 2.2. O need to run a schedule job every day at 3:00 Am. What is the best way to do it?

I tried hangfire it stops after some time. We need to set IIS server always running. I googled and found hosted service in. Net core. Can anyone tell me what is the best approch to run a job daily in web application in dot net core?

like image 868
umer Avatar asked Apr 22 '20 18:04

umer


People also ask

How do I schedule a job in .NET core?

We can use Quartz scheduling to perform a job every 5 minutes. To begin, make a project with the ASP.NET core web application template. Choose Asp.net MVC for your online application. There are two ways to install the Quartz package.

How do you execute a method in ASP NET MVC for every 24 hours?

For example, you can use pingdom.com free account to call a certain url every <enter time here> period. So in pingdom you can enter the url to your MVC action. And that will be called every 24 hours and your code will run on schedule.

Do Cronjobs run automatically?

The cron reads the crontab (cron tables) for running predefined scripts. By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.


1 Answers

I've not personally tried it for .NET Core honestly, but have you tried Quartz Scheduler? https://www.quartz-scheduler.net/

[UPDATE]: According to Quartz GitHub repo: "Quartz.NET supports .NET Core/netstandard 2.0 and .NET Framework 4.6.1 and later."

like image 154
Siavash Mortazavi Avatar answered Sep 21 '22 06:09

Siavash Mortazavi