如何使.NET Windows服务在安装后立即启动?
解
protected override void OnAfterInstall(System.Collections.IDictionary savedState){ base.OnAfterInstall(savedState); using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) serviceController.Start();}