Performing a C # function every 24 hours

I have a C # function for creating thumbnails, these images are displayed on the ie ASP.net web page. So, as I would programmatically call this function, let it be at 16:00 or 3:00 every day.

+6
source share
3 answers

Write your code as a standalone console application, and then configure a scheduled task on the server to run the application at this time every day.

If you want the task to run more than once a day, you will have to set up a scheduled task for each time.

To configure a scheduled task, go to Control Panel> Scheduled Tasks , and then click "Add Scheduled Task". This opens a wizard that guides you through the process:

  • Choose your application
  • Give the task a name and select a frequency - you need Daily.
  • Set a time and whether you want this task every day, on weekdays or every day. Also when you want to run a task.
  • Enter the credentials of the user account to run the application. It would be better to set up a separate account for this.

Then you are done.

You can configure the settings after setting it up.

+12
source share

Either write a Windows service or a job schedule .

+2
source share

Another way to handle this is to use Quartz.NET . This is a pretty powerful job scheduling library. This answer talks about using it with asp.net.

+1
source share

All Articles