Error 1939. The service 'My_Service' could not be configured
Problem: MSI 5.0 package fails with an ERROR 1939 during "MsiConfigureServices" standard action execution. I tried to use "MsiConfigureServices" standard action in the msi package to configure a custom service. The MSI package fails to execute on Win 7 + OSs. The exact same issue can be found at this forum discussion
As per the MSI failure log:
MSI (s) (DC:09) 11:44:00 am:342): Executing op: ServiceConfigureFailureAction(,Name=ServiceConfigRepro,Event=5,ResetPeriod=604800,RebootMessage=[~],Command=[~],Actions=1,DelayA
MSI (s) (DC:09) 11:44:00 am:342): changing configuration of failure action for service ServiceConfigRepro.
MSI (s) (DC:09) 11:44:00 am:420): Error: 5. Failed to change current configuration of failure action for service ServiceConfigRepro
MSI (s) (DC:09) [11:44:00 am:420): Failed to change configuration of failure action for service ServiceConfigRepro
MSI (s) (DC:09) 11:44:00 am:420): Note: 1: 2205 2: 3: Error
MSI (s) (DC:09) 11:44:00 am:420): Note: 1: 2228 2: 3: Error 4: Select 'Message' from 'Error' where 'Error' = 1939
MSI (c) (30:10) 11:44:00 am:732): Font created. Charset: req=0, ret=0, Font: req=MS Shell Dlg, ret=MS Shell Dlg
Error 1939. The service ‘My_Service’ (ServiceConfigRepro) could not be configured. There may be a problem with the package, or with your authorization. Make sure that your permissions are sufficient to configure the system services.
In MSI 5.0 the MsiServiceConfig and the MsiServiceConfigFailureActions tables are introduced and more information is available at Windows Installer team blog https://blogs.msdn.com/b/windows_installer_team/archive/2009/03/04/enhanced-service-configuration-with-windows-installer-5-0.aspx?Redirected=true
After debugging, I found it was due to a bug in MSI 5.0. Here are the details:
I tried to configure failure action for service (i.e. My_Service) if the service fails and action ‘SC_ACTION_RESTART’ (i.e. Restart the service) is set. We can see this field (i.e. 1, that specify action ‘SC_ACTION_RESTART’, refer this for more detail) in Action table of ‘MsiServiceConfigFailureActions’ table of the MSI package. I noticed that it returns ACCESS_DENIED while calling with SC_ACTION_RESTART and the service handle does not have SERVICE_START rights. So MSIEXEC fails due to Authorization issue. The solution would be to choose another failure action than restating the service (as per below options). I have tried with ‘SC_ACTION_RUN_COMMAND’ field for failure Action, where we can run command like ‘SC Start <ServiceName>’ to start service. It perfectly worked for me.
This field contains an array of integer values that specify the actions taken by the SCM if the service fails. Separate the values in the array by [~]. The integer value in the Nth element of the array specifies the action performed when the service fails for the Nth time. Each member of the array is one of following integer values.
Constant |
Description |
SC_ACTION_NONE 0 |
No action. |
SC_ACTION_REBOOT 2 |
Restart the computer. |
SC_ACTION_RESTART 1 |
Restart the service. |
SC_ACTION_RUN_COMMAND 3 |
Run a command. |
The table would like this after making the required changes.
Comments
- Anonymous
March 23, 2016
Thank you very much for this workaround! It is very helpful for meI wonder why Microsoft hasn't fixed that bug yet...