Scheduled execution of .NET code in a hosting environment?

I have about 40 lines of .NET code in a console application that reads and streams an RSS feed and stores the information in a database. I need this code to run every night as long as the RSS feed exists (undefined). I am currently running a console application. from my home computer.

Because I can't trust myself to remember this every night, somehow I need this code to be hosted. I would like to use this application somehow. or the code (it can easily be placed in the code of the ASP.NET page and run on page load) is automatically launched without the need to launch the console application. manually.

Any ideas?

EDIT: I don't want to run this code from my computer; I cannot guarantee that my computer will not hibernate or connect to the Internet every night.

EDIT: Right now I think I am creating a background thread using BackgroundWorker in Application_Start from global.asax, load the RSS feed once a day and Thread.Sleep () the rest of the time.

+2


source to share


5 answers


You can use the Windows built-in task scheduler to launch the console application .



+2


source


Despite the controversy, Jeff Atwood wrote about how they did it for SO using cache expiration. Check it out at http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ .



You can use a similar method and schedule the cache to expire at the moment you want the process to start.

+2


source


I would suggest just using the 'at' command instead of hosting this little app.

C:\>at /?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

      

+1


source


Email your web host. Some managed hosts will set up a scheduled task for you.

They will likely have different policies for calling the scheduled task (for example, some may require it to be an aspx page, not an EXE)

+1


source


Have you looked at Quartz Scheduler for .NET ?

Enter the tag: Quartz.NET is a full-featured open source job scheduling system that can be used from the smallest applications to large enterprise systems.

0


source







All Articles