简体   繁体   中英

Windows Service vs Task Scheduler - manual start

I am trying to develop an application that will scan a website, get data from the website and save that data into database 3x per day at given hour that can be set in xml configuration file. As an addition group of users can trigger the start of the application manually max few times per day.

I am looking for pros and cons of using a windows service for this solution or should I set a 3 scheduled tasks that will run the console application?

If I will decide to use a windows service then what is the best way to trigger a manual start of the service while the service is already running? The group of users will have some kind of web interface to trigger manual start.

This could be easily done using a scheduled task. I would just set a 3x scheduled tasks that will run the application at given time and the group of users could just start the .exe file from the web interface. However how to only allow the user to run a manual trigger only if application is not already running?

Since the UI is ultimately in web, and thus the service itself won't need any UI, I would go with Windows service which can be triggered to start by the user through web or automatically as the time comes (by its internal code).

Then, either:

  1. In the service it has something to indicate its status as running which can be captured by the web app to see it, or,
  2. In the web, there is mechanism to request/monitor the service status

Is quite flexible I think. I would go with whichever is easier.

I picked the task scheduler option for my case. It was easier to implement the manual triggering by users mechanism.

Pros - Triggers can be added easly using the taks scheduler library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM