2016-11-07 150 views
0

我正在尝试使用针对我的C#项目的服务安装来执行WiX安装程序。这是我第一次尝试,我不明白为什么它不起作用。无法使用WiX安装程序启动服务

我已经设置了ServiceInstall但是当我运行安装程序,我挡在本页面:

enter image description here

几秒钟后,我得到了错误:

enter image description here

我使用相同的参数从Visual Studio安装程序创建了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> 

回答

3

的“启动失败”的错误可能是一个特权的问题,但该消息只是一个默认的消息是否是它的权限或没有。

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

  1. 如果丢失一个依赖DLL(或依赖性等依赖性)尚未安装。这包括.NET框架。

  2. 该服务依赖于正在安装到GAC的程序集,并且这些程序集实际上并未在服务启动时提交,因此这是缺少依赖关系的特例。

  3. “无法启动”基本上是服务中的启动代码没有完成。您的OnStart代码崩溃可能会导致此问题。国际海事组织服务部门应始终提供跟踪以追踪提供诊断的路径和重要价值。

+0

几个小时后,我终于找到了解决方案。确实缺少一个dll。我试图运行相同的服务的另一个程序,我错过了SQL服务器的DLL。我下载了DLL,现在它工作。 –

相关问题