Failed to install and start Windows services in WiX installer

前端 未结 5 1759
一向
一向 2021-01-01 19:43

I am creating an MSI package for installing and starting Windows services using WiX v3.8. The code as follows:



        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 19:59

    The error message you are getting is the generic message the Windows Installer sends when it fails to start a service during install. Almost always the issue is that the Service is missing a dependency or otherwise not fully configured when the start occurs. To debug the root issue try:

    1. Install the MSI package.
    2. When the error dialog comes up indicating there is a failure to start the service *do not dismiss the dialog.
    3. Start services.msc or use sc.exe from the command-line to attempt to start your service. The Windows Installer should have configured enough of the service to be able to debug deeper why it failed.
    4. If necessary debug into your service executable directly to see why it cannot be started.

    If this is a service written in managed code, ensure that it does not depend on files being placed in the GAC. Files are not in the GAC until very, very late during the installation process. If you must use files in the GAC, you will not be able to use the built-in ServiceControl element and will have to write a custom action to run after InstallFinalize. Note that after InstallFinalize a custom action will not be elevated so your service will have to support being started by non-elevated users. Again, I recommend not depending on the GAC.

    Good luck debugging your service!

提交回复
热议问题