Windows Services Architecture


Three program types are necessary to operate a Windows Service:

  • A service program

  • A service control program

  • A service configuration program

The service program itself provides the actual functionality you are looking for. With a service control program, it's possible to send control requests to a service, such as start, stop, pause, and continue. With a service configuration program, a service can be installed; it's copied to the file system, written into the registry, and configured as a service. Although .NET components can be installed simply with an xcopy, because they don't need to write information to the registry, installation for services requires registry configuration. A service configuration program can also be used to change the configuration of that service at a later point.

These three ingredients of a Windows Service are discussed in the following subsections.

Service Program

Before looking at the .NET implementation of a service, take a look at it from an independent point of view and discover what the Windows architecture of services looks like and what the inner functionality of a service is.

The service program implements the functionality of the service. It needs three parts:

  • A main function

  • A service-main function

  • A handler

Before discussing these parts, you must be introduced to the Service Control Manager (SCM). The SCM plays an important role for services, sending requests to your service to start and to stop it.

Service Control Manager

The SCM is the part of the operating system that communicates with the service. Figure 36-2 illustrates how this communication works with a UML sequence diagram.

image from book
Figure 36-2



Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net