除了service.StartType = ServiceStartMode.Automatic我的服务在安装后没有启动
解
在我的ProjectInstaller上插入此代码
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName))
serviceController.Start();
}
Run Code Online (Sandbox Code Playgroud)
感谢ScottTx和Francis B.
构建Windows服务最简单的语言是什么?
在这种情况下,最简单的将被定义为最少的代码量,以及进入该语言的最低点.