Frage

I have a windows project that runs queries from a database and generates a bunch of emails. I want to run this weekly through the windows scheduler. What is the best way to set this up?

I am looking in visual studio on how to set this up . .

Should I create a console app? a windows service ? I only have a few tasks that I want to run once a week so I don't think i want to have it running all the time . . based on that(and articles like this) it seems like a windows service is not what I want. Any other suggestion for the best way to set this up.

My guess is that I would start up the app with some argument which will tell it which function to run but besides that I am not sure what the best practice is here. I assume the scheduler will kick off the job and then shut down but it seems like a windows service is always running ..

War es hilfreich?

Lösung

For your purposes, you can just create a console app. And yes, just pass the arguments from the task scheduler to the program.

A windows service would probably be overkill, but if the schedule becomes more frequent you can easily switch to a windows service later.

Andere Tipps

You could either do a command line app, or a winform app. Either way, you will probably want to take command line arguments, so you can switch out operational modes as a command line via the windows task. I would also recommend it writing out a log, so you can keep track of when it launched, what it did while it was running, and when it exists, that might help in the future when auditing the emails that went out, didn't go out, etc...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top