views:

68

answers:

5

I have a long running, compute and disk intensive task that needs to run nightly on Window Server 2008; my Framework of choice is .NET 3.5 sp1. There's a chance this task could fail too for any number of reasons (i.e. lack of disk space) and I'd like to make sure errors are handled & reported reasonably. Also, this task would require permission to do things like create a database connection and read/write to the file system. What options are available for getting things like this done?

Edit: My question is more about whether to use windows schedule or some other mechanism to kick off the process.

A: 

Do you have more specific questions? All of this is totally doable. You can catch and log exceptions in a log file, and mail those results using SMTP. You can also make connections to a database which is very simple. Is there one single thing that you are having problems with that we could help?

You can use the windows scheduler to set this app up as say a job to run at a specific time or duration, etc.

JonH
A: 

Code it.... What is the question ? Create a good solid code that handles everything and you'll have your task. you can make a service out of it, and ask windows to restart if fails, or just wrap it in an infinate loop with try / catch all but take care of things that if not fixed won't worth continue....

Dani
+1  A: 

This sounds like it's just a standard console application that needs to run on a set scheduled (Windows Scheduled Tasks) and needs simple logging/reporting and communication capabilities and probably some linq2sql for db crud operations.

Frankly, at this point, it sounds like your options are wide open.

Stephen Wrighton
+2  A: 

Create a Console Application. Inside the main() method, put a try-catch, and use SmtpClient to send notifications about unhandled exceptions. Compile it and add an entry to run it using the Scheduled Task applet.

gWiz
Note: This answer is the minimal requirements to meet the given problem scenario. With more a detailed problem, a more specific answer can be given.
gWiz
+1  A: 

Two words ... exception handling

One other word ... logging

In addition to all the other very sound advice offered by the others here, if this is to be a long running process to run unattended, I would pay extra attention to how you handle exceptions and how you log/report them so that you know if something went wrong and have enough information to correct the issue.

James Conigliaro