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

NicoleH
66202023
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.

link

answered 07 Jun '12, 05:37

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
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:

<stopWindowsService>
    <displayName>${displayName}</displayName>
    <serviceName>${serviceName}</serviceName>
    <abortOnError>1</abortOnError>
    <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>
    <delay>10000</delay>
    <showMessageOnError>1</showMessageOnError>
    <onErrorActionList>
        <!-- Abort due to unable to stop service -->
        <logMessage>
            <text>Aborting uninstall.  Unable to complete the uninstallation because we could not stop the Windows Service - ${displayName}.</text>
        </logMessage>
        <exit exitCode="1"/>
    </onErrorActionList>
</stopWindowsService>

Then, the preUninstallationActionList just calls

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

for each service in your distribution.

link

answered 08 Jun '12, 05:12

DevHopeful_2012's gravatar image

DevHopeful_2012
176131521
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

By RSS:

Answers

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

Tags:

×54
×18

Asked: 07 Jun '12, 05:28

Seen: 3,455 times

Last updated: 13 Jun '12, 04:26