I just read this: What is the benefit of developing the application as a windows service? but I\'m still unsure of when to use a windows service.
I have a couple tas
For any scheduled task, I would usually recommend a Windows Service, for the following reasons:
As far as other examples of applications that can be windows services, a lot of times they are useful for applications such as remoting - you can have a service run a remoting server that clients connect to. Obviously very useful for data processing tasks that you want to run in the background as well, or processes where you want to send an email on certain conditions, etc.
In general I've always found scheduled tasks to be much more fragile and unreliable. And unless you have them log properly, often harder to debug.
In reference to the bug with the Timer - if you read the bug report on MS's site, you can see that it is caused when you call "Stop" inside the Timer_Elapsed event. The answer to this is simple - don't call stop. Instead, wrap the whole thing in a check for a "IsRunning" boolean and only run if IsRunning is false. Even if there wasn't an issue with the timer, you need to do this anyway because the timer might re-fire during your execution if your execution takes longer than your timer interval.
Anyway, I still think using scheduled tasks is a weak solution and gives me flashbacks of Windows 95.