S h o r t S t o r i e s

// Tales from software development

What to do when a Windows Service hangs during startup

leave a comment »

I have a Windows Service that queries a database during startup and found that after deploying the final release version it failed to start. Worse still, the status in the Services console was shown as ‘Starting’ and it couldn’t be stopped or started again. The service’s log file was also locked.

After running the query interactively I realised that a configuration change in the database was causing it to fail. This was easily fixed but I still had the problem of the hung service.

It was beginning to look like the server would have to be rebooted but quick search on the internet suggested the following:

1. Use ‘sc queryex <service-name>’ to get the process id (PID) of the service.

2. Use ‘taskkill /pid <pid> /F’ to terminate the service process.

Advertisements

Written by Sea Monkey

June 17, 2010 at 8:00 pm

Posted in Environments

Tagged with

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: