In this chapter, you have seen what Windows Services are and how you can create them with the .NET Framework. Applications can start automatically at boot-time with Windows Services, and you can use a privileged system account as the user of the service.
The .NET Framework has great support for Windows Services. All the plumbing code that's necessary for building, controlling, and installing services is built into the .NET Framework classes in the System.ServiceProcess namespace. By deriving a class from ServiceBase, you can override methods that are invoked when the service is paused, resumed, or stopped. For installation of services, the classes ServiceProcessInstaller and ServiceInstaller deal with all registry configurations needed for services.
Support technologies such as event logging and performance monitoring can easily be used with .NET applications with classes in the System.Diagnostics namespace: EventLog and PerformanceCounter.