C# Console Application - Keep it running

 picture · Mar 30, 2009 · Viewed 21.7k times · Source

I am about to develop a console application that will be required to continually run and carry out work at specific times.

My question is what is are best methods or practices to keep your application alive?

My thought were: A loop that never ends? A timer that sleeps and then jumps to routine when required (after set sleep period)?

I will be compiling the application into an exe and then running it as a service using AlwaysUp.

Regards..

Peter

Answer

user83286 picture user83286 · Mar 30, 2009

A better solution would be to write a console application that does its job and quits. You can then use the Windows Task Scheduler to run it periodically.