Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 无法使用WiX安装程序启动服务_Windows_Wix_Installation - Fatal编程技术网

Windows 无法使用WiX安装程序启动服务

Windows 无法使用WiX安装程序启动服务,windows,wix,installation,Windows,Wix,Installation,我正在尝试为我的C#项目安装WiX安装程序和服务。这是我第一次尝试,我不明白为什么它不起作用 我已设置ServiceInstall,但在运行安装程序时,我在此页面中被阻止: 几秒钟后,我发现了错误: 我使用相同的参数从VisualStudio安装程序创建了WiX安装。代码如下: <Product ... /> <Feature Id="ProductFeature" Title="$(var.product)" Level="1"> <Componen

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

我已设置ServiceInstall,但在运行安装程序时,我在此页面中被阻止:

几秒钟后,我发现了错误:

我使用相同的参数从VisualStudio安装程序创建了WiX安装。代码如下:

<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>

错误“启动失败”可能是一个权限问题,但该消息只是一条默认消息,无论它是否为权限

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

  • 缺少的依赖Dll(或依赖项的依赖项等)尚未安装。这包括.NET框架

  • 该服务依赖于安装到GAC的程序集,而这些程序集在服务启动时并没有实际提交,因此这是缺少依赖项的特殊情况

  • “启动失败”基本上是指服务中的启动代码未完成。OnStart代码中的崩溃可能会导致此问题。IMO服务应始终具有跟踪功能,以跟踪路径和重要值,从而提供诊断

  • “启动失败”错误可能是一个权限问题,但该消息只是一个默认消息,无论它是否为权限

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

  • 缺少的依赖Dll(或依赖项的依赖项等)尚未安装。这包括.NET框架

  • 该服务依赖于安装到GAC的程序集,而这些程序集在服务启动时并没有实际提交,因此这是缺少依赖项的特殊情况

  • “启动失败”基本上是指服务中的启动代码未完成。OnStart代码中的崩溃可能会导致此问题。IMO服务应始终具有跟踪功能,以跟踪路径和重要值,从而提供诊断


  • 几个小时后,我终于找到了解决办法。的确,一个dll丢失了。我试图用相同的服务运行另一个程序,但缺少SQL server的dll。我下载了dll,现在它工作了。几个小时后,我终于找到了解决方案。的确,一个dll丢失了。我试图用相同的服务运行另一个程序,但缺少SQL server的dll。我下载了dll,现在它可以工作了。