The new TopShelf location, http://github.com/Topshelf/Topshelf , has been updated with a patch allowing this behavior.
RunConfiguration cfg = RunnerConfigurator.New(x => { x.AfterStoppingTheHost(h => { Console.WriteLine("AfterStop called invoked, services are stopping"); }); x.ConfigureService<TownCrier>(s => { s.Named("tc"); s.HowToBuildService(name=> new TownCrier()); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); });
source share