protected override void OnStop() { _logger.Information("Service stopping..."); // Shutdown code for your service here. _serviceRunner.Stop(); _logger.Information("...service stopped."); }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main() { #if DEBUG var serviceRun = new ServiceRun(); serviceRun.Start(); while (!Console.KeyAvailable) { } serviceRun.Stop(); Console.WriteLine(@"bye bye"); #else var servicesToRun = new ServiceBase[] { new WrapperService() }; ServiceBase.Run(servicesToRun); #endif }