Click here to Skip to main content
12,997,531 members (58,526 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I need to check a daily log file for errors. I have created a C# class with one method that checks the file and sends an e-mail with the answer. I want the system to run this class automatically every night.

Any help would be greatly appreciated.
Posted 5-Oct-11 4:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The easiest an simplest way would be to employ the Windows Task Scheduler[^] service.

Build your class into a console application, then use the Task Scheduler to schedule it. This can be done using the GUI (Control Panel → Administrative Tools → Task Scheduler), or at the command line using <a href="">at</a>[^] or <a href="">schtasks</a>[^]. The latter is much more flexible.

If you would like to do this programatically, you want to develop a Windows NT Service[^]. This is a much bigger task.
SAKryukov 5-Oct-11 11:22am
Agree, using the Task Scheduler service is probably the best way, my 5.
Writing a whole Windows Service for this task could be a big overkill for this particular problem, good to mention though.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Create a console app project using your class and schedule it on your server.

Here you will find an guide on how to schedule a task:[^]

And here you can start with a creating a console app:[^]


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 5 Oct 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100