microcafe icon indicating copy to clipboard operation
microcafe copied to clipboard

Topshelf process not really quitting

Open vaniovanio opened this issue 7 years ago • 1 comments

Hi,

What could be done in order for the command window to close when the Topshelf service is disposed? I'm not able to find any information on that in the Topshelf documentation. Say, the "Admin.Service.exe" is running, I want to stop it, so I go to the window hosting it and press CTRL+C. This shuts down the service, but the executable is still running (e.g. I can see it in Task Manager). How can I avoid that?

Thanks! And great project, it gave me lots of insight on microservices in .Net.

vaniovanio avatar Aug 28 '17 10:08 vaniovanio

Running it locally, I can't repro the problem you're having.

In program.cs the line: s.WhenStopped(tc => tc.Stop()); should catch the Ctrl+C and call the stop method in the Admin Service class.

That Stop() method simply calls webApp.Dispose();

So I suspect the Dispose() method is not finishing. Is it possible you have a long running request in your service that is not returning, which in turn is keeping a thread running?

rbanks54 avatar Sep 08 '17 03:09 rbanks54