Interacting with Windows Services

You can view the services that are used on your computer by opening the Service Control Manager user interface. To do so from the Start menu in Windows 7 or Windows 2008, select Administrative Tools ⇒ Services. If the Administrative Tools menu isn't visible from the Start menu go through the Control panel, select Control Panel ⇒ Administrative Tools ⇒ Services.

Those of you on Windows 8 have two options. The first is to go to the charms bar on the right hand side and select Settings. In the Settings window you will see “Tiles.” Select the Tiles option and you will find a single setting for “Show administrative tools.” Move this option from the default of “No” to “Yes.” At this point your Start screen will repopulate and on the far right side you'll find a new tile for Services.

Alternatively, on Windows 8 you can use the Desktop button that is on the Start screen. From the desktop you can open the Windows File Explorer and look at your Desktop folder. Within the Desktop folder you should see a reference to the Control Panel. Accessing the Control Panel, switch your view to Small icons and then you can select the Administrative Tools folder. A new window will open and you can access the Services dialog. Note that other paths on Windows 8 will also allow you to get here, this is just one such method.

Using the Service Control Manager, a service can be set to automatically start when the system is booted, or it can be started manually. Services can also be stopped or paused. The list of services contained in the Service Control Manager includes the current state for each service. Figure 16.1 shows the Service Control Manager in Windows 7. (Note it looks unchanged on Windows 8.)

Figure 16.1 Service Control Manager

16.1

The Status column indicates the current state of the service. If this column is blank, then the service is not running. Other possible values for Status are Started and Paused. You can access additional settings and details concerning a service by double-clicking it.

When a service is started, it automatically logs in to the system using one of the following accounts:

  • User account—A regular Windows account that allows the program to interact with the system; in essence, the service impersonates a user.
  • LocalSystem account—Not associated with a particular user. This built-in account has a lot of privileges, and can roughly be thought of as the equivalent of an administrator account for services.
  • LocalService account—Not associated with a particular user. This built-in account has a more limited set of privileges, and is commonly used for routine services.
  • NetworkService account—Not associated with a particular user. This built-in account is similar to LocalService, but is designed for services that communicate across the local network rather than working only on the local system.

The Service Control Manager shown in Figure 16.1 is part of the operating system (OS), which is what supports Windows Services; it is not a part of the .NET Framework. Any service run by the OS is exposed through the Service Control Manager, regardless of how the service was created or installed. You can also examine the installed Windows Services via the Server Explorer in Visual Studio.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset