How to make a .NET Windows Service start right after the installation?
- by Jader Dias
Besides the service.StartType = ServiceStartMode.Automatic my service does not start after installation
Solution
Inserted this code on my ProjectInstaller
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName))
serviceController.Start();
}
Thanks to ScottTx and Francis B.