O'Reilly logo

Professional C# 2008 by Karli Watson, Morgan Skinner, Jay Glynn, Bill Evjen, Christian Nagel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 23

Windows Services

Windows Services are programs that can be started automatically at boot time without the need for anyone to log on to the machine.

In this chapter, you learn:

  • The architecture of Windows Services, including the functionality of a service program, a service control program, and a service configuration program
  • How to implement a Windows Service with the classes found in the System.ServiceProcess namespace
  • Installation programs to configure the Windows Service in the registry
  • How to write a program to control the Windows Service using the ServiceController class
  • How to troubleshoot Windows Service programs
  • How to react to power events from the operating system

The first section explains the architecture of Windows Services. You can download the code for this chapter from the Wrox Web site at www.wrox.com.

What Is a Windows Service?

Windows Services are applications that can be automatically started when the operating system boots. They can run without having an interactive user logged on to the system and do some processing in the background. For example, on a Windows Server, system networking services should be accessible from the client without a user logging on to the server. On the client system, services are useful as well; for example, to get a new software version from the Internet or to do some file cleanup on the local disk. You can configure a Windows Service to be run from a specially configured user account or from the system user account — ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required