My team is having a debate which is better: a windows service or scheduled tasks. We have a server dedicated to running jobs and currently they are all scheduled tasks. Some jobs take files, rename them and place them in other directories on the network. Other jobs extract data from SQL, modify it, and ship it elsewhere. Other jobs ftp files out. There is a lot of variety, but all in all, they are fairly straightforward.
I am partial to having each of these run as a windows service instead of a scheduled task because it is so much easier to monitor a windows service than a scheduled task. Some are diametrically opposed. In the end, none of us have that much experience to provide actual factual comparisons between the two methods. I am looking for some feedback on what other have experienced.
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.
Services are for running "constant" operations all the time. Scheduled Tasks are for running single units of work at scheduled intervals (what you want).
Take advantage of Windows services to build applications that you want to run in the background or execute automatically at predefined intervals of time. A Windows service is a long-running application that can be started automatically when your system is started.
The Task Scheduler service allows you to perform automated tasks on a chosen computer. With this service, you can schedule any program to run at a convenient time for you or when a specific event occurs.
If it runs constantly - windows service.
If it needs to be run at various intervals - scheduled task.
Scheduled Task -
Use them wisely
Sceduling jobs with the build in functionality is a perfectly valid use. You would have to recreate the full functionality in order to create a good service, and unless you want to react to speciffic events, I see no reason to move a nightly job into a service.
Its different when you want to process a file after it was posted in a folder, thats something I would create a service for, thats using the filesystem watcher to monitor a folder.
I think its reinventing the wheel
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