I'm trying to stop a Windows service on a local machine (the service is Topshelf.Host
, if that matters) with this code:
serviceController.Stop(); serviceController.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
timeout
is set to 1 hour, but service never actually gets stopped. Strange thing with it is that from within Services MMC snap-in I see it in "Stopping" state first, but after a while it reverts back to "Started". However, when I try to stop it manually, an error occurs:
Windows could not stop the Topshelf.Host service on Local Computer. Error 1061: The service cannot accept control messages at this time.
Am I missing something here?
Kill the svchost.exe netsvcs process. Then start the Application Information service from Services. Check all automatic services as a few may have stopped and start them again. This should resolve the issue.
I know I am quite late to answer this but I faced a similar issue , i.e., the error: "The service cannot accept control messages at this time." and would like to add this as a reference for others.
You can try killing this service using powershell (run powershell as administrator):
#Get the PID of the required service with the help of the service name, say, service name. $ServicePID = (get-wmiobject win32_service | where { $_.name -eq 'service name'}).processID #Now with this PID, you can kill the service taskkill /f /pid $ServicePID
Either your service is busy processing some big operation or is in transition to change the state. hence is not able to accept anymore input...just think of it as taking more than it can chew...
if you are sure that you haven't fed anything big to it, just go to task manager and kill the process for this service or restart your machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With