A Windows service is an application without a user interface that runs independently of any user-started applications. Typically a service starts automatically when the computer startseven if a user does not log on to the computer. Think of them as background processes that keep things humming smoothly.
There are two ways to see the services that are running on your own machine. The first is under Computer Management. Right-click the My Computer icon on your desktop and choose Manage, and then expand Services and Applications. Click the Services node and you'll see the services running on your machine, as in Figure 12.1.
Figure 12.1. The services running on your computer are listed under the Services node in Computer Management.
As a developer, you'll like the convenience of using the Server Explorer in Visual Studio .NET to view and control your services. If it's not already open, open it by choosing View, Server Explorer. Expand the Servers node, and then your own machine, and then Services. As in Figure 12.2, you'll see the same list of services as you would see under Computer Management, without having to bring up a separate tool.
Figure 12.2. You can see and control services from within Visual Studio.
Many services are referred to as servers. HTTP or Web servers, mail servers, and ftp servers all run as services on a Windows machine, as does the print server, any fax software you have installed, and similar applications. They wait in the background for requests or events to occur, and then they handle those requests or events in some way.
Another important category of services provides maintenance duties for another application. Consider an application that displays information, such as internal company announcements. Each piece of information has an expiry date, and after this date it is deleted. The job of deleting expired information is handled by a service that runs in the middle of the night, looks through all the information in the system, and deletes any with expiry dates before the current date. This ensures that expired information is always deleted, and doesn't impose any performance delays on the application that displays information to the user. This architectural choice is an excellent one for applications used by many users.