I want to create a web api which will accept one parameters like SocialSecurityNumber and it will check a database if it exists then it will push record into a new table if it did not exists in that table then it will pop it out from that table and this service need to be run everything like a cron job with no specific time , What is the best way to achieve this using .NET MVC.
Loading
Sam HobbsPosted Oct 5, 2023, 6:59 PM
A cron job is not something that runs continuously. Cron is a scheduler, like the Windows Task Scheduler, that runs jobs as specified. I assume that Cron is a service that runs continuously but the jobs that it shedules are not normally (probably never) run continuously. In both Unix/Linux and in Windows services are what run continuously.
If you want someting like cron in Linux but for Windows then you can use the Windows Task Scheduler.
Amit MohantyPosted Oct 5, 2023, 5:30 AM
You can use a library like Hangfire. Hangfire allows you to schedule background jobs in .NET applications.
Sam HobbsPosted Oct 4, 2023, 5:36 PM
Are you trying to create a service like the ones shown in the Services tab of the Task Manager?
Create A Windows Service In C#
https://www.c-sharpcorner.com/article/create-windows-services-in-c-sharp
Create Windows Service using BackgroundService - .NET | Microsoft Learnhttps://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service?pivots=dotnet-7-0
Sachin SinghPosted Oct 4, 2023, 10:29 AM
You can use Hangfire or Quartz for the same.
Mark TaborPosted Oct 4, 2023, 10:23 AM
I did not encountered with any problem I would like to know how I could achieve that type of cron job like it continuesly runs and push and pop record like do I need to create a web service or windows service etc.
Amit MohantyPosted Sep 27, 2023, 11:32 AM
Hey Mark Tabor,
Could you clarify at which point you encountered the problem?