dotnet/extensions

Support Stop_Pending service status in Microsoft.Extensions.Hosting.WindowsServices

xqrzd opened this issue · 1 comments

xqrzd commented

Currently when stopping a service in Microsoft.Extensions.Hosting.WindowsServices, the service is immediately reports to SCM that it's stopped, even though the process may still be running. A fix would be to simply wait in ServiceBase.OnStop https://github.com/aspnet/Extensions/blob/master/src/Hosting/WindowsServices/src/WindowsServiceLifetime.cs#L72 (maybe wait on IHostApplicationLifetime.ApplicationStopped?)

I'm happy to attempt a PR if this is worth doing. The same thing could be done on startup if it's useful.

Yes, please give it a try and let us know if it works as expected.