I know variations of this topic have already been asked, but here's my situation:
I have about 30 FTP interface applications. Each interface has their own requirements and configuration, but basically it downloads files from a source server – sometimes daily, sometimes every minute (some, possibly even scheduled in the seconds)
For my initial development, I wrote a C# class library that does all FTP work. This application (be it a console app or windows service) will most likely be run under Windows Server 2012.
Now comes the next piece and I’m trying to decide between:
1) Writing a console app (or a powershell script?) that takes command line inputs plus a configuration file for each interface. I would schedule this using Windows Task Scheduler. For deployment of these interfaces, I could create a batch file that uses the “schtasks.exe” to create and configure the task. One task for each interface. Sounds easy peasy…
OR
2) Write a windows services application… but here, I am confused. Do I create and install a service for each one of my interfaces? (i.e. only thing different might be the config file). Or, do I create a a main service that spawns off threads for each interface defined in a single config file?
If I did this as a single service, how do I manage the maintenance/deployment of this? If I stop the service, would it not affect all the interfaces? And how do I perform the actual scheduling? I’ve read the suggestion is to use Quartz.Net scheduler or just .Net Timers.
---
Some additional thoughts: Here are some readings on StackOverflow which brings up these topics/concerns:
windows service vs scheduled task Scheduled console app vs Windows service? When is it appropriate to use each
Task Scheduler Concerns
- List item
- May need to be logged in? (I’ve read this is not true)
- Issues on machine admin password change (I’ve read this is not true)
- Issues with running in high-authority accounts (NetworkService, LocalSystem, or a User)
- Issue with multiple processes / long running transactions This would be really bad for me, for example, if two processes tried to download (and delete) the same source FTP file.
- Experience of many is that this is not as stable/reliable as Windows Services, especially on earlier operating systems pre Windows7
- Less infrastructure support (e.g. failure policies for retry, monitoring, etc.)
- Concerns when scheduling in the seconds…
Windows Service Concerns
- List item
- Potential issues with Timers
- More complicated
Console App + Scheduled Task Concerns
- List item
- Can’t run in background – so hosting server will have command prompts launching This is a serious problem. If I have 30 FTP Interfaces and each is scheduled to run every minute/hour, that’s a lot of windows!!!
- How do I get around this? Use PowerShell scripts instead?
Looking forward to some feedback, and sample code/scripts, if relevant also highly appreciated.
Thanks