Characteristics of a Windows Service


To properly design and develop a Windows Service, it’s important to understand how it differs from a typical Windows program. Here are the most important characteristics of a Windows Service:

  • A Windows Service can start before a user logs on. The system maintains a list of Windows Services, which be set to start at boot time. Services can also be installed such that they require a manual startup and will not start at bootup.

  • A Windows Service can run under a different account from that of the current user. Most Windows Services provide functionality that needs to be running all the time, and some load before a user logs on, so they cannot depend on a user being logged on to run.

  • A Windows Service has its own process. It does not run in the process of a program communicating with it (Chapter 27 has more information on processes).

  • A Windows Service typically has no user interface. This is because the service may be running under a different account from that of the current user, or the service may start at bootup, which means that the calls to put up a user interface might fail because they are out of context (it is possible to create a Windows Service with a user interface, but Visual Basic 2005 cannot be used to do it; you’ll learn why later).

  • A Windows Service requires a special installation procedure; just clicking on a compiled EXE won’t run it. The program must run in a special context in the operating system, and a specific installation process is required to do the configuration necessary for a Windows Service to be run in this special context.

  • A Windows Service works with a Service Control Manager (discussed shortly). The Service Control Manager is required to provide an interface to the Windows Service. External programs that want to communicate with a Windows Service (for example, to start or stop the service) must go through the Service Control Manager. The Service Control Manager is an operating-system-level program, but it has a user interface that can be used to start and stop services, and this interface can be accessed through the Computer Management section of the Control Panel.




Professional VB 2005 with. NET 3. 0
Professional VB 2005 with .NET 3.0 (Programmer to Programmer)
ISBN: 0470124709
EAN: 2147483647
Year: 2004
Pages: 267

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