Windows service with Hangfire 1.6.7 hangs on stop

We have couple Windows Services (built using Nancy.Hosting.Self) that use Hangfire. In last couple month we noticed that these services sometimes fail to stop during “net stop XXX” and raise error “The service cannot be controlled in the present state”. The only thing that changed that we can see is Hangfire.Core upgrade to 1.6.7.


  • Are there any known issues with Hangfire and Windows services?
  • What is the right way to stop Hangfire server? Stop(), SendStop() ?
  • Is there a more detailed Hangfire logging (non-default) that we can enable to troubleshoot the issue?

Thank you