Looking to run automated jobs in .NET application

1.2k views Asked by At

Within a .NET application (.NET Framework 4.5), the following is occurring:

  • A single record in a table in an SQL Server database is referred to as a job
  • When the job is run, C# code is called
  • Briefly to explain what it is doing, the job, when run, converts PDFs in a folder directory location, to images in SQL Server
  • Currently, these jobs run successfully, when the user manually runs them

Does anyone have a recommendation on how these jobs may be run as automated, and not require user intervention? I'm trying to find a process similar to the following:

  • A daily process will look for all jobs that have a 'next run date' of the current date (the 'next run date' will be stored in a table/column in SQL Server)
  • When a job is run, the C# code is to be called and run, without user intervention
2

There are 2 answers

0
Noman Khan On BEST ANSWER

If you can insert the first part of your requirement (to look for all jobs that have a 'next run date' of the current date (the 'next run date' will be stored in a table/column in SQL Server)) in the C# application that is already executed manually then you only need a Task Scheduler to Execute this C# Application on a daily basis.

0
scgough On

you basically need to set up a CRON job. If your "job" can operate on a URL, you could use a service like "easycron.com" to set up a call to this URL at regular intervals.

Alternatively, the same thing might be possible with your hosting if they allow CRON jobs to be set up.

If this isn't a web-facing app - maybe a scheduled task calling the app (if it is a console based EXE) directly on the server. You'll obviously need access to the server at an admin level for that.