繁体   English   中英

WIX 服务安装程序覆盖服务安装程序设置

[英]WIX service installer overrides service Installer settings

我正在开发一项服务,该服务后来由 WIX 安装程序部署。 这是服务安装程序 class

this.ServiceInstaller.DisplayName = "My Service";
            this.ServiceInstaller.ServiceName = "MyService";
            this.ServiceInstaller.ServicesDependedOn = new string[] {
        "ServiceA",
        "ServiceB",
        "ServiceC"};

这是 WIX 安装程序代码

    <Component Id="MyService.exe" Guid="{1234}">
        <File Id="MyService.exe" KeyPath="yes" Source="$system\$(sys.BUILDARCH)\MyService.exe">
          <netfx:NativeImage Id="MyService.exe" Platform="all" Priority="1" />
        </File>
        <ServiceInstall Id="MyService.exe" DisplayName="My OTHER Service" Name="MyService" ErrorControl="normal" Start="auto" Type="ownProcess">
          <ServiceDependency Id="ServiceD" />
          <ServiceDependency Id="ServiceE" />
          <ServiceDependency Id="ServiceF" />
          <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="10" />
        </ServiceInstall>
        <ServiceControl Id="MyService.exe" Name="MyService" Stop="install" Remove="uninstall" />
    </Component>

据我所知,WIX 中的配置完全覆盖了项目安装程序中的设置。 (特别是名称和依赖项)这是默认行为吗? 如果 WIX 将完全忽略它,那么拥有 serviceInstaller class 有什么意义?

交叉链接:几个支持答案: 1) Chris Painter 关于服务凭证保存和/或处理2)服务调试


ServiceInstaller 类:此功能通常用于在development期间用于testing purposes 您使用InstallUtil.exe .NET 工具进行安装和/或 Visual Studio。


首选 MSI :有很多方法可以安装服务,但如果可以的话,您应该使用 MSI 表ServiceInstallServiceControl 以下是有关各种或多或少疯狂选项的更多详细信息。


服务注册选项:来自Phil WilsonMSI MVP"The Definitive Guide to Windows Installer"作者)的一份古老的经典文档列出了多种安装服务的方法:

  • 1) MSI - ServiceInstallServiceControl表 - 和其他一些。
  • 2) Win32 - CreateService API。
  • 3)注册表- 手动更新,通常是不受欢迎的“幕后”选项。
  • 4) WMI 类- Win32_Service 主要好处:可编写脚本 包装CreateService (Win32)。
  • 5) InstallUtil.exe - .NET 工具和安装程序类。
  • 6) MSI 和安装程序 Class 自定义操作- 通过 shim dll InstallUtilLib.Dll在 Visual Studio 安装项目中调用InstallUtil.exe - 不是我最喜欢的选项。 很多复杂性基本上没有任何收获。 只需使用 MSI 中的服务表。 自动的。

InstallUtil.exe :当 .NET 到来时,在 .NET 框架中引入了一个名为 InstallUtil.exe 的工具以及一组安装程序类。 ServiceInstaller 框架 class 包含安装服务的代码,开发人员可以覆盖 class 方法以提供额外的安装时代码。 这为开发人员轻松安装服务以进行测试提供了一种有用的方法。


多年后,Phil 的名单中可以添加以下内容:

更具异国情调:Srvany(将应用程序作为服务运行,非常过时 - 不要使用)。


Windows 服务常见问题 (FAQ): https://www.coretechnologies.com/WindowsServices/FAQ.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM