通过


ServiceInstaller 构造函数

定义

初始化 ServiceInstaller 类的新实例。

public:
 ServiceInstaller();
public ServiceInstaller();
Public Sub New ()

注解

若要安装服务,请创建一个继承自 Installer 类的项目安装程序类,并将类上的属性设置为 RunInstallerAttributetrue。 在项目中,为每个服务应用程序创建一个 ServiceProcessInstaller 实例,并为应用程序中的每个服务创建一个 ServiceInstaller 实例。 在项目安装程序类构造函数中,使用 ServiceProcessInstallerServiceInstaller 实例设置服务的安装属性,并将实例添加到 Installers 集合。

构造 ServiceInstaller 函数自动生成一个事件日志源,其 Log 属性设置为计算机的应用程序日志和一个 EventLogInstaller。 设置的 /> 属性应与服务相同时,事件日志的属性会自动设置为相同的值。 如果安装失败,将自动删除源。

构造 ServiceInstaller 函数将属性 StartType 设置为 ServiceStartMode.Manual 指定用户启动服务。 可以重置属性以 ServiceStartMode.Automatic 指定服务在计算机重新启动时启动。

适用于

另请参阅