Error 1061 the service cannot accept control messages at this time : Topshelf


I have deployed the windows service built with Topshelf host and when I try to stop it, it is throwing the below error
“Error 1061 the service cannot accept control messages at this time” 

Here I have observed the below behaviors:

  1. When I am running in my local machine with Visual Studio, working fine without any errors.
  2. When I am running in my local machine as a service it is throwing the above error and showing the status as stopping and it is getting stopped after some time (30 mins)
  3. When I am running this in my server as a service it is throwing the above error and not stopping.

Then I found the below power shell code to stop the service here.

#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

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s