I am following the DTF guidelines...

I am using service control:
<ServiceControl Id="StartSettingsService" Name="TITUS.Enterprise.Settings.Host" 
Stop="both" Wait="yes" />

But there are some instances where a service(s) hasn't stopped so this is an 
extra fail safe...

Steve

-----Original Message-----
From: David Watson [mailto:dwat...@sdl.com] 
Sent: October-18-13 9:34 AM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] returned actual error code 1154 from custom action

Check out this 
http://stackoverflow.com/questions/3560370/custom-action-in-c-sharp-used-via-wix-fails-with-error-1154

Why are you not using the service control element to ensure the service is 
stopped?
http://wixtoolset.org/documentation/manual/v3/xsd%5Cwix%5Cservicecontrol.html


-----Original Message-----
From: Steven Ogilvie [mailto:steven.ogil...@titus.com]
Sent: 18 October 2013 13:37
To: General discussion about the WiX toolset.
Subject: [WiX-users] returned actual error code 1154 from custom action

Hi,

I am calling a custom action on uninstall just to ensure that our 5 services 
are actually stopped before we try to remove them...

However I am getting an error that confuses me since everything looks kosher...

Anyone see any issues with what I am doing?

Here is the error from the log file:
MSI (s) (6C:D4) [23:30:16:875]: Executing op: 
ActionStart(Name=CA_STOPESSERVICE.A54690A6_C7B5_477D_ADAF_916A4A173FDF,Description=CA:
 Stopping TITUS Enterprise Settings Service...,) MSI (s) (6C:D4) 
[23:30:16:875]: Executing op: 
CustomActionSchedule(Action=CA_STOPESSERVICE.A54690A6_C7B5_477D_ADAF_916A4A173FDF,ActionType=3137,Source=BinaryData,Target=StopServiceForUninstall,CustomActionData=TITUS.Enterprise.Settings.Host|)
MSI (s) (6C:28) [23:30:16:937]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSIF6FB.tmp, Entrypoint: StopServiceForUninstall 
CustomAction CA_STOPESSERVICE.A54690A6_C7B5_477D_ADAF_916A4A173FDF returned 
actual error code 1154 but will be translated to success due to continue marking


Custom Action:
<CustomAction Id="SetStopESService" Property="CA_STOPESSERVICE" 
Value="TITUS.Enterprise.Settings.Host|" /> <CustomAction Id="CA_STOPESSERVICE" 
BinaryKey="BIN_CustomActionMM" DllEntry="StopServiceForUninstall" 
Impersonate="no" Execute="deferred" Return="ignore" />

<InstallExecuteSequence>
<Custom Action="SetStopESService" After="InstallValidate">Installed</Custom>
<Custom Action="CA_STOPESSERVICE" After="StopServices">Installed</Custom>

DTF Custom Action DLL C#

public static ActionResult StopServiceForUninstall(Session session)
        {
            var serviceName = string.Empty;
            try
            {
                if (session == null)
                {
                    throw new ArgumentNullException("session");
                }

                var tempString = GetSessionProperty(session, 
"CustomActionData", false);
                var parts = tempString.Split(new[] { '|' });
                serviceName = parts[0];

                var sc = new ServiceController { ServiceName = serviceName };

                if (sc.Status == ServiceControllerStatus.Running)
                {
                    // Stop the service
                    try
                    {
                        // Stop the service.
                        sc.Stop();
                        sc.WaitForStatus(ServiceControllerStatus.StopPending, 
TimeSpan.FromSeconds(30));
                    }
                    catch (TimeoutException exception)
                    {
                        WriteErrorLogInstall(session, "TimeoutException: could 
not stop the " + serviceName + " service.", exception, true);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteErrorLogInstall(session, "Could not stop service: " + 
serviceName + " .", ex, true);
            }
            return ActionResult.Success;
        }

Thanks,

Steve


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register > 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to