Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a windows application which should send email on daily basis ,i have done this using windows service.i will trigger the service using windows task scheduler.should i set the timer inside the service as well? if not, when the service is triggered using windows task scheduler will it invoke onstart() event? is it ok if i write my email sending code in onstart() event?
Posted

If you are using Windows Scheduler to start the service, it might be better just to use a simple Console Application instead of a windows service.
 
Share this answer
 
Comments
Oshtri Deka 16-Mar-12 6:48am    
I agree.
As Wayne has said, you don't need a windows service for this.

You want to do something at a particular time or interval? Then use the scheduler and simply have it execute a Console Application or a windows forms application, just with no UI. :)

Introducing a windows service just over complicates what you need to do and isn't what a service is designed for anyway. A service should be something that is required to be 'always running' for whatever reason (e.g hosting a WCF endpoint, monitoring a file system)
 
Share this answer
 
Comments
Oshtri Deka 16-Mar-12 6:49am    
Again I agree.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900