DotNetCore.WindowsService icon indicating copy to clipboard operation
DotNetCore.WindowsService copied to clipboard

service start timeout too short

Open hiramwu opened this issue 6 years ago • 1 comments

private static void StopService(HostConfiguration<SERVICE> config, ServiceController sc) { if (!(sc.Status == ServiceControllerStatus.Stopped | sc.Status == ServiceControllerStatus.StopPending)) { sc.Stop(); sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(1000)); Console.WriteLine($@"Successfully stopped service ""{config.Name}"" (""{config.Description}"")"); config.OnServiceStop?.Invoke(config.Service); } else { Console.WriteLine($@"Service ""{config.Name}"" (""{config.Description}"") is already stopped or stop is pending."); } }

In this Method, the service start timeout only set to one second, it's too short to start service

hiramwu avatar Nov 24 '18 02:11 hiramwu

Thanks for spotting the mistake. Feel free to contribute a PR, I am happy to accept that but not doing active development on this at the moment.

PeterKottas avatar Mar 14 '19 16:03 PeterKottas