无法使用WiX安装程序启动服务 [英] Unable to start Service with WiX Installer

查看:48
本文介绍了无法使用WiX安装程序启动服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的C#项目安装带有服务安装的WiX安装程序.这是我第一次尝试,我不明白为什么它不起作用.

I'm trying to do a WiX installer with a service install for my C# project. It's the first time I try and I don't understand why it doesn't work.

我已经设置了ServiceInstall,但是当我运行安装程序时,此页面被阻止了:

I have set a ServiceInstall but when I run the setup, I'm blocked in this page :

几秒钟后,我收到了错误消息:

After a few seconds I got the error :

我使用相同的参数从Visual Studio安装程序创建了WiX安装.有代码:

I created the WiX install from a Visual Studio Installer with the same parameters. There is the code :

<Product ... />

<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
    <ComponentRef Id ="MyService"/>
</Feature>

<UIRef Id="WixUI_InstallDir"/>

<!-- Set install directory -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
</Product>

<Fragment>
    <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="$(var.product)">
            <Component Id="MyService" Guid="{GUID-HERE}" KeyPath="yes">        
              <!-- service will need to be installed under Local Service -->

              <ServiceInstall
                Id="MyService"
                Type="ownProcess"
                Vital="yes"
                Name="MyService"
                DisplayName="Service"
                Description=""
                Start="auto"
                Account="NT AUTHORITY\LocalService"
                ErrorControl="normal"/>
              <ServiceControl Id="StartDDService" Name="MyService" Start="install" Wait="no" />
              <ServiceControl Id="StopDDService" Name="MyService" Stop="both" Wait="yes" Remove="uninstall" />
            </Component>        
        </Directory>
    </Directory>
</Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents">
      <Component Id="ProductComponent" Guid="{}" Directory="INSTALLFOLDER">

        <File Id="MyService.exe" Source="$(var.MyService.TargetDir)\MyService.exe"/>
      </Component>
    </ComponentGroup>
  </Fragment>

推荐答案

启动失败"错误可能是特权问题,但是无论是否具有特权,该消息都只是默认消息.

The "failure to start" error could be a privilege issue, but the message is just a default message whether it it's privilege or not.

这些情况通常是服务本身或依赖项:

These cases are usually the service itself or a dependency:

  1. 尚未安装缺少的依赖项Dll(或依赖项的依赖项等).其中包括.NET框架.

  1. A missing dependent Dll (or dependency of a dependency etc) has not been installed. That includes the .NET framework.

服务取决于安装到GAC的程序集,并且在启动服务时实际上不会提交这些程序集,因此这是缺少依赖项的特例.

The service depends on an assembly being installed to the GAC, and these assemblies are not actually committed when services are started, so that's a special case of a missing dependency.

无法启动"基本上是指服务中的启动代码未完成.您的OnStart代码崩溃可能导致此问题.IMO服务应始终具有跟踪​​功能,以跟踪路径和有效值以提供诊断信息.

"Failure to start" is basically that the start code in the service didn't complete. A crash in your OnStart code could cause this. IMO Services should always have tracing available to trace the path and significant values to provide diagnostics.

这篇关于无法使用WiX安装程序启动服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆