【发布时间】:2020-04-27 18:56:34
【问题描述】:
谁能帮我找出我的 Windows 服务无法启动的原因。
当我使用installutil 安装它时,它运行良好。我决定使用wix 为最终用户创建安装程序,但它不会启动。
这是我的代码
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="IWErpnextPoll" Manufacturer="IWW" Language="1033" Version="1.0.0.0" UpgradeCode="ccc3c2fe-d20f-45ce-b978-4dc7c84ce6c8">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="IWERPNextPoll_Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="IWErpnextPoll" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent">
<File Source="$(var.IWErpnextPoll.TargetPath)" />
<ServiceInstall Id="ServiceInstaller" Name="IWErpnextPoll" Type="ownProcess" Vital="yes" DisplayName="ERPNext2Sage" Description="A background service." Start="auto" Account=".\LocalSystem" ErrorControl="normal" Interactive="no" />
<ServiceControl Id="StartService" Name="IWErpnextPoll" Stop="both" Start="install" Remove="uninstall" Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
安装程序抛出此错误:
Service 'IWErpnextPoll' (IWErpnextPoll) failed to start. Verify that you have sufficient privileges to start system services
我在命令行中运行了以下内容:
msiexec /i IWERPNextPoll_Setup /l*v log.txt
但是(我未经训练的眼睛)在非常非常的日志文件中没有发现任何看起来不对劲的东西。
我编写的服务是我第一次尝试 C#。我很乐意得到任何指点。
【问题讨论】:
-
检查事件日志,检查缺少的运行时(在准系统虚拟机上测试?),在您的服务组件中启用任何调试 - 例如 logging,想起来这里更多:previous answer on service startup problems.