【问题标题】:WiX service don't start: service failed to start verify that you have sufficient privilegesWiX 服务不启动:服务启动失败验证您是否有足够的权限
【发布时间】:2016-09-22 16:21:34
【问题描述】:

我有一个 java 应用程序。我已经制作了一个 scansol-agent-app.exe 文件,我需要使用 WiX 制作安装程序。下面是scansol-agent.wxs文件的代码。我需要将此应用程序安装为 Windows 服务。 Servise 安装良好,但无法启动。 Windows 显示错误:“服务无法启动 - 验证您是否有足够的权限来启动系统服务” 我尝试了所有可以找到的变体,但没有任何结果。如何启动此服务?

    <?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Product Id="*" 
            UpgradeCode="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}" 
            Name="Scansol Agent Application Service" 
            Version="0.0.1" 
            Manufacturer="ScienceSoft" 
            Language="1033">

      <Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" Manufacturer="ScienceSoft"/>
      <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

      <Property Id="WHSLogo">1</Property>

    <WixVariable Id="WixUILicenseRtf" Value="license.rtf" />

      <UI>  
        <Property Id="ApplicationFolderName" Value="WiX Demo" />
        <Property Id="WixAppFolder" Value="WiXxperMachineFolder" />
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
        <UIRef Id="WixUI_InstallDir" />
        <!-- Skip license dialog -->
        <Publish Dialog="WelcomeDlg"
             Control="Next"
             Event="NewDialog"
             Value="InstallDirDlg"
             Order="2">1</Publish>
        <Publish Dialog="InstallDirDlg"
             Control="Back"
             Event="NewDialog"
             Value="WelcomeDlg"
             Order="2">1</Publish>

          <!--<Property Id="DefaultUIFont">DlgFont8</Property>-->
          <TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" />
          <TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
        <Dialog Id="InstallDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
          <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
            <Text>{\DlgTitleFont}Ready to Install</Text>
          </Control>
          <Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
            Default="yes" Text="Install">
            <Publish Event="EndDialog" Value="Return" />
          </Control>
        </Dialog>     
      </UI>

      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramFilesFolder"  Name="PFiles">
            <Directory Id="INSTALLDIR" Name="ScansolAgent">
               <Component Id="ApplicationServiceInstall" Guid="{908B7199-DE2A-4dc6-A8D0-27A5AE444FEA}">
                    <File Id='ApplicationFile1' Source="scansol-agent-app.exe" DiskId='1' KeyPath='yes' Vital='yes'/>
                    <File Id="ApplicationFile2" Source="config.cfg"  DiskId='1' KeyPath='no' Vital='yes'/>
                <ServiceInstall
                    Id="ServiceInstaller"
                    Type="ownProcess"
                    Vital="yes"
                    Name="ScansolAgentService"
                    DisplayName="Scansol Agent Application Service"
                    Description="File Monitoring and Loading to server"
                    Start="auto"
                    Account="LocalSystem"
                    ErrorControl="ignore"   
                    Interactive="no"
                >
                </ServiceInstall>
                <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ScansolAgentService" Wait="yes" />
              </Component>
            </Directory>
         </Directory>       
      </Directory>

      <Feature Id="DefaultFeature" Level="1" Title="ScansolAgentAppService">
         <ComponentRef Id="ApplicationServiceInstall" />
      </Feature>
   </Product>
</Wix>

【问题讨论】:

  • 您在哪里看到“服务无法启动...”错误?在安装期间,还是在安装后启动服务时?
  • 您是否尝试过手动安装服务?也许它只是损坏或缺少一些库。即使用“sc”命令行工具。
  • 我在安装过程中遇到了这个错误。服务安装。但我不能启动它。当我使用 install4j 工具从同一个 .jar 创建安装程序时 - 我没有任何问题!
  • 您也可以使用eventvwr.exe查看事件,找出原因。正如@Nikolay 指出的那样,它可能是一些缺少的库或类似的。

标签: wix windows-services installation wix3.10 service-installer


【解决方案1】:

原因可能很多,其中绝大多数都已解决,但是,我有一个案例,没有任何答案或建议适用于它。最后我找到了我的情况的原因:在 ServiceInstall 标记中有一个名为 Account 的属性,在我的情况下是 LocalService,但是,在我的 Windows 服务项目中,在生成的文件中我为我的服务分配了帐户成为本地系统。因此,如果在 Windows 服务项目中设置的服务帐户与您稍后在 ServiceInstall 的帐户属性下的 WiX 源文件中指定的帐户不匹配,那么 Windows 安装程序将成功安装您的服务,但是在启动它时将失败。结论,确保两个地方的服务帐户匹配。同样,这可能不是您的情况,但值得仔细检查。

【讨论】:

  • 好的,谢谢。只是浪费了几个小时,因为我正在安装到 LocalSytem 而不是 LocalSystem(在“y”之后缺少一个“s”)。痛...
【解决方案2】:

请看这个答案:https://stackoverflow.com/a/65342252/6657445。对于这种情况,因为这不是域或本地用户帐户,请尝试将“交互式”翻转为“是”。我以这种方式安装了其他服务没有问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多