如何使.NET Windows服務(wù)在安裝后立即啟動(dòng)?除了service.startType=ServiceStartMode.AutomaticMy服務(wù)安裝后不會(huì)啟動(dòng)解在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 回答
- 0 關(guān)注
- 705 瀏覽
添加回答
舉報(bào)
0/150
提交
取消