如何使.NET Windows服务在安装后立即启动?除了service.startType=ServiceStartMode.AutomaticMy服务安装后不会启动解在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.
3 回答
- 3 回答
- 0 关注
- 689 浏览
添加回答
举报
0/150
提交
取消