Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I recently learnt how to create windows service.
(Simple Windows Service Sample[^])

But, however, I have a question: What do you use them for? ... and HOW?

Of course we see a lot of services on windows for different purposes.
I just wanted to know how to do something other than a typical "Hello World"-like service.
For this reason I also wanted to know what ever can be done with services.
Posted

Ok. Lets pick an example, a real life scenario:
You need to send an email every monday to all the users registered to a given webstite. You can have this windows service in place that will keep running - every monday it will automatically send the email with content specified. You don't need to have any manul intervention in between.
 
Share this answer
 
Comments
Ashok Gowtham 9-Oct-10 19:12pm    
Alright, that seems like a good task for a service.
Cab you please let me know how to 'connect' a service with a normal forms application.
Services, unlike normal programs, need not run in the context of an interactive session. So whenever you need something to be done, without the need of having anyone log in, a service is a good way to deal with the problem.

Of course, services come with a whole different bag of problems: you can't (easily) indicate errors to users, because there's not necessarily a user logged in (which is often the case with servers).

If you ever have to write a service, make it also run as an application (I believe there is an article on it here at CP). It makes development and debugging a lot easier.
 
Share this answer
 

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

  Print Answers RSS


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