views:

85

answers:

3

I have been quite comfortable with windows-services, I have been practicing since from last two weeks. Would you please explain me some of the basic applications of Windows service, so that I can take it as homework and practice. (it need not be too basic)

I have already designed and implemented a project/service which is meant for closing all the browsers, when I open a program(or process) saying "Gtalk".

I am interested and very eager to learn more things about Windows services.

Regards.

+3  A: 

The word 'service' (Windows or othwerwise) implies that it is something that runs without a User Interface and possibly without any user interaction; it is constantly 'running' waiting to service commands sent to it.

a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as Windows is running, or they can be started manually when required.

Ref.

Mitch Wheat
thanx for the response, Well. The basic Idea I got is from wiki. I just wanted some homework projects to practice with.
infant programmer
Well, it a bit hard to answer unless you have something specific in mind. How about creating a service that submits a search to several different search engines and collates the results? Or create a service that monitors other services? The list is endless...
Mitch Wheat
yup that's cool. :-)
infant programmer
+1  A: 

You could try implementing your own scheduler? I think the most basic use of services is to have automatic process run according to a particular schedule.

Phil
okey .. good-one .. thank you
infant programmer
you're welcome!
Phil
+1  A: 

Few points

  1. The OnStart method should return within 30 seconds or the SCM will time out. OnStart should handle all initialization of your service. The constructor is called when the application's executable runs, not when the service runs. The executable runs before OnStart. When you continue, for example, the constructor is not called again because the SCM already holds the object in memory.

  2. ServiceAccount: Some of the bugs in windows service are caused by inability to access privileged resources. Choose account type carefully or have a custom account.

  3. Asynchronous Programming: In case you are going to connect to web services, then asynchronous programming approach is far better approach.

  4. System.Timers.Timer: In case your service does "something" periodically, consider using System.Timers.Timer.

What can Services do under Windows?

Testing windows service

PRR