|
From: Steven O. <Ste...@ti...> - 2013-10-18 12:37:06
|
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
|