0

我有一个正在使用 installutil.exe 安装的 Windows 服务。如何确保安装后立即自动启动服务。这是服务 ProjectInstaller 类

using System.ComponentModel;

namespace MedicalService_WindowsService
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }
    }
}
4

1 回答 1

0

使用ServiceInstaller. 设置StartType自动。这将确保服务自动启动,但不会实际启动服务。为此,在服务安装完成后,使用ServiceController.Start()显式启动服务。

于 2014-03-27T11:11:41.973 回答