How to make a .NET Windows Service start right after the installation?
Posted
by Jader Dias
on Stack Overflow
See other posts from Stack Overflow
or by Jader Dias
Published on 2009-07-28T17:13:46Z
Indexed on
2010/05/18
15:10 UTC
Read the original article
Hit count: 280
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.
© Stack Overflow or respective owner