开发 Windows 服务应用Develop Windows service apps

使用 Visual Studio 或 .NET Framework SDK,可以通过创建作为服务安装的应用程序来轻松创建服务。Using Visual Studio or the .NET Framework SDK, you can easily create services by creating an application that is installed as a service. 这种类型的应用程序称为 Windows 服务。This type of application is called a Windows service. 借助框架功能,可以创建、安装服务,启动、停止服务并及控制服务的行为。With framework features, you can create services, install them, and start, stop, and otherwise control their behavior.

备注

在 Visual Studio 中,可以使用 Visual C# 或 Visual Basic 在托管代码中创建服务,如果需要,可以与现有的 C++ 代码进行互操作。In Visual Studio you can create a service in managed code in Visual C# or Visual Basic, which can interoperate with existing C++ code if required. 或者,可以通过使用 ATL 项目向导在本机 C++ 中创建 Windows 服务。Or, you can create a Windows service in native C++ by using the ATL Project Wizard.

本节内容In this section

Windows 服务应用程序介绍Introduction to Windows Service Applications

提供 Windows 服务应用程序、服务生存期以及服务应用程序与其他常见项目类型的区别的概述。Provides an overview of Windows service applications, the lifetime of a service, and how service applications differ from other common project types.

演练:在组件设计器中创建 Windows 服务应用程序Walkthrough: Creating a Windows Service Application in the Component Designer

提供在 Visual Basic 和 Visual C# 中创建服务的示例。Provides an example of creating a service in Visual Basic and Visual C#.

服务应用程序编程体系结构Service Application Programming Architecture

介绍服务编程中使用的语言元素。Explains the language elements used in service programming.

如何:创建 Windows 服务How to: Create Windows Services

介绍使用 Windows 服务项目模板创建和配置 Windows 服务的过程。Describes the process of creating and configuring Windows services using the Windows service project template.

ServiceBase - 介绍用于创建服务的 ServiceBase 类的主要功能。ServiceBase - Describes the major features of the ServiceBase class, which is used to create services.

ServiceProcessInstaller - 介绍 ServiceProcessInstaller 类的功能,该类与 ServiceInstaller 类一起用于安装和卸载服务。ServiceProcessInstaller - Describes the features of the ServiceProcessInstaller class, which is used along with the ServiceInstaller class to install and uninstall your services.

ServiceInstaller - 介绍 ServiceInstaller 类的功能,该类与 ServiceProcessInstaller 类一起用于安装和卸载服务。ServiceInstaller - Describes the features of the ServiceInstaller class, which is used along with the ServiceProcessInstaller class to install and uninstall your service.

从模板创建项目 - 介绍本章中使用的项目类型以及如何从中进行选择。Create Projects from Templates - Describes the projects types used in this chapter and how to choose between them.