If we need to write a program that works periodically, which way do we prefer? Writing a windows service or writing a console application which works as scheduled task?
A Windows service in meant to run an application 24/7 and it has many recovery options. Task Scheduler is meant to run an application periodically and not 24/7; therefore there isn't any recovery option.
Task Scheduler alternatives can include freeware schedulers, enterprise solutions and workflow automation tools. Our list of top Task Scheduler alternatives includes workload automation tools, enterprise job schedulers, lightweight schedulers and more.
You would typically want to use Windows services when you need to build and implement long-running jobs that would be executed at predefined intervals of time. Your Windows service would continue to run in the background while the applications in your system can execute at the same time.
Services are for running "constant" operations all the time. Scheduled Tasks are for running single units of work at scheduled intervals (what you want). Really, Scheduled Tasks itself is a service already.
I would suggest running the process as a scheduled task if you can, and writing a service only if you need to. Services are quite a bit more difficult to write (correctly), and if you're running your process on a schedule of any sort, you're much better off using the windows scheduler than attempting to build a scheduler of your own (within the servce).
If you're trying to decide between the two, then obviously using the Task Scheduler is a viable option. And if using the Task Scheduler is a viable option, then building a service is almost certainly the wrong choice.
Depends on just how regular you need it to run.
If its something that needs to run every 60 seconds all day, I'd go with a Windows Service.
If its something that only needs to run once a day, I'd go with Scheduled Task
Anything in the middle... use your judgement :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With