WiX 服务无法启动:服务无法启动请验证您是否有足够的权限

st_*_*ane 3 installation windows-services wix service-installer wix3.10

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

\n\n
    <?xml version="1.0"?>\n<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">\n   <Product Id="*" \n            UpgradeCode="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}" \n            Name="Scansol Agent Application Service" \n            Version="0.0.1" \n            Manufacturer="ScienceSoft" \n            Language="1033">\n\n      <Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" Manufacturer="ScienceSoft"/>\n      <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>\n\n      <Property Id="WHSLogo">1</Property>\n\n    <WixVariable Id="WixUILicenseRtf" Value="license.rtf" />\n\n      <UI>  \n        <Property Id="ApplicationFolderName" Value="WiX Demo" />\n        <Property Id="WixAppFolder" Value="WiXxperMachineFolder" />\n        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />\n        <UIRef Id="WixUI_InstallDir" />\n        <!-- Skip license dialog -->\n        <Publish Dialog="WelcomeDlg"\n             Control="Next"\n             Event="NewDialog"\n             Value="InstallDirDlg"\n             Order="2">1</Publish>\n        <Publish Dialog="InstallDirDlg"\n             Control="Back"\n             Event="NewDialog"\n             Value="WelcomeDlg"\n             Order="2">1</Publish>\n\n          <!--<Property Id="DefaultUIFont">DlgFont8</Property>-->\n          <TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" />\n          <TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />\n        <Dialog Id="InstallDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">\n          <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">\n            <Text>{\\DlgTitleFont}Ready to Install</Text>\n          </Control>\n          <Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"\n            Default="yes" Text="Install">\n            <Publish Event="EndDialog" Value="Return" />\n          </Control>\n        </Dialog>     \n      </UI>\n\n      <Directory Id="TARGETDIR" Name="SourceDir">\n         <Directory Id="ProgramFilesFolder"  Name="PFiles">\n            <Directory Id="INSTALLDIR" Name="ScansolAgent">\n               <Component Id="ApplicationServiceInstall" Guid="{908B7199-DE2A-4dc6-A8D0-27A5AE444FEA}">\n                    <File Id=\'ApplicationFile1\' Source="scansol-agent-app.exe" DiskId=\'1\' KeyPath=\'yes\' Vital=\'yes\'/>\n                    <File Id="ApplicationFile2" Source="config.cfg"  DiskId=\'1\' KeyPath=\'no\' Vital=\'yes\'/>\n                <ServiceInstall\n                    Id="ServiceInstaller"\n                    Type="ownProcess"\n                    Vital="yes"\n                    Name="ScansolAgentService"\n                    DisplayName="Scansol Agent Application Service"\n                    Description="File Monitoring and Loading to server"\n                    Start="auto"\n                    Account="LocalSystem"\n                    ErrorControl="ignore"   \n                    Interactive="no"\n                >\n                </ServiceInstall>\n                <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ScansolAgentService" Wait="yes" />\n              </Component>\n            </Directory>\n         </Directory>       \n      </Directory>\n\n      <Feature Id="DefaultFeature" Level="1" Title="ScansolAgentAppService">\n         <ComponentRef Id="ApplicationServiceInstall" />\n      </Feature>\n   </Product>\n</Wix>\n
Run Code Online (Sandbox Code Playgroud)\n

小智 5

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