0

Possible Duplicate:
Run windows service task at a specific time using C#

I am building an app in .NET (c#). I am trying to find out how to write to a log at a particular time everyday at various times I specify.

I understand I can easily do this with a scheduled task, but I would like to keep the app running (preferably a console app). And launch commands at designated times.

Thank you!

Community
  • 1
  • 1
TheWebGuy
  • 11,429
  • 16
  • 52
  • 72

3 Answers3

1

You could take a look at the Quartz .NET library. It's worked well for me.

Marcus
  • 5,407
  • 3
  • 31
  • 54
0

You want to use one of the 3 .Net Timer classes, most likely System.Timers.Timer. You'd set the Timer's Interval property, and do your logging in the event handler for the Timer's Elapsed event

ssis_ssiSucks
  • 1,476
  • 1
  • 12
  • 11
-1

If you want an application to keep running then use a Windows service but, personally, given what I know of your requirements, I'd probably just go with a scheduled task.

Windows Service : http://msdn.microsoft.com/en-us/library/zt39148a%28v=vs.80%29.aspx

Ste
  • 1,136
  • 2
  • 10
  • 30