Automatically start a windows service after install
- by Chuck Savage
Which of the two of these are preferable (and why) from the service installer, I've seen both mentioned on different websites (and here on stackoverflow Automatically start a Windows Service on install and How to automatically start your service after install?).
// Auto Start the Service Once Installation is Finished.
this.AfterInstall += (s, e) => new ServiceController("service").Start();
this.Committed += (s, e) => new ServiceController("service").Start();