Saturday, November 7, 2009

Chapter 13. Windows Services









Chapter 13. Windows Services


The server programs in Chapters 11 and 12 were console applications written to run in the background. In principle, the servers could run indefinitely, serving numerous clients as they connect, send requests, receive responses, and disconnect. That is, these servers could provide continuous services, but to be fully effective, the services must be manageable.


Windows Services,[1] previously known as NT Services, provide the management capabilities required to convert our servers into services that can be initiated on command or, at system boot time, before any user logs in, and can also be paused, resumed, and terminated. Services even make it possible to monitor the health of a service. Information about services is maintained in the registry.

[1] This terminology can be confusing as the Windows systems provides numerous services that are not the Windows Services described here. However, using the term "Windows" throughout the book when talking specifically about the API is equally confusing.


Ultimately, any server system, such as those developed in Chapters 11 and 12, should be converted to a service, especially if it is to be widely used by customers or within an organization.


Windows provides a number of services; examples include the telnet, fax, and security accounts' management services as well as device drivers. There is an administrative tool, accessible from the control panel, that will display the full set of services.


Chapter 6's JobShell (Program 6-3) provides rudimentary server management by allowing you to bring up a server under job control and send a termination signal. Windows Services, however, are much more comprehensive and robust, and the main example is a conversion of JobShell so that it can control Windows Services.


This chapter also shows how to convert an existing console application into a Windows service and how to install, monitor, and control the service. Event logging, which allows a service to log its actions, is also described.










    No comments:

    Post a Comment