【发布时间】:2010-11-14 19:02:26
【问题描述】:
除了 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();
}
感谢 ScottTx 和 Francis B。
【问题讨论】:
-
安装后不启动还是重启后不启动?
标签: .net windows-services installation