I added stop and delete of service to my pre-uninstall actions. When uninstall is executed I get error messages: failed to stop ... service and failed to delete ... service. Is it possible to debug it somehow? I see that the service exists and it is running, I'm the only user that performed the installation so I'm the files and also defined as admin. What can be the problem?

asked 07 Jun '12, 05:28

NicoleH's gravatar image

accept rate: 50%

You can use Event Viewer tool to check details of the error. If there is a note about error to stop the service anywhere in the logs?

Can you stop the service manually going to services panel? (services.msc)

The error may be that service itself refused to stop.

If the service does not stop, InstallBuilder is unable to delete it since it is still running.


answered 07 Jun '12, 05:37

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

Ran into the same problem, where some services were active and/or undergoing development and didn't properly respond to the stop command. There really isn't anything that you can do about it from the uninstaller perspective, as wojciechka indicated.

So, I created a custom function to uninstall a service. The function handles the varying service actions to stop and remove per platform, and, most importantly, exits the uninstaller if any service fails to stop. The following is just the stop action:

    <customErrorMessage>Unable to complete the uninstallation because we could not stop the Windows Service - ${displayName}.  Please stop this service manually and restart the uninstallation.</customErrorMessage>
        <!-- Abort due to unable to stop service -->
            <text>Aborting uninstall.  Unable to complete the uninstallation because we could not stop the Windows Service - ${displayName}.</text>
        <exit exitCode="1"/>

Then, the preUninstallationActionList just calls

<uninstallService serviceName="some_service" displayName="some_name"/>

for each service in your distribution.


answered 08 Jun '12, 05:12

DevHopeful_2012's gravatar image

accept rate: 9%

I tried to use the above suggestion, the installation was aborted and I stopped the service manually, after that, I received error on service delete. From some reason, it cannotbe stopped neither deleted from pre-uninstall. I tried to stop another service that I have on my machine and it didn't work either. I can stop and delete the service without any problem using sc command or control panel.

(13 Jun '12, 04:17) NicoleH

How much does it takes to stop the service manually? You may need to tweak the <delay> of the action.

(13 Jun '12, 04:26) juanjo ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 07 Jun '12, 05:28

Seen: 3,455 times

Last updated: 13 Jun '12, 04:26