简体   繁体   English

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

[英]WIX service installer overrides service Installer settings

i am working on a service that is later deployed by a WIX installer.我正在开发一项服务,该服务后来由 WIX 安装程序部署。 this is service installer class这是服务安装程序 class

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

and this is the WIX installer code这是 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>

as far as i can tell, the configuration in the WIX completely overrides the settings in the project installer.据我所知,WIX 中的配置完全覆盖了项目安装程序中的设置。 (specifically name and dependencies) is this a default behavior? (特别是名称和依赖项)这是默认行为吗? whats the point of having a serviceInstaller class if WIX is going to completely ignore it?如果 WIX 将完全忽略它,那么拥有 serviceInstaller class 有什么意义?

Cross Linking : A couple of supporting answers: 1) Chris Painter on service credential preservation and / or handling , 2) Service debugging .交叉链接:几个支持答案: 1) Chris Painter 关于服务凭证保存和/或处理2)服务调试


ServiceInstaller classes : This feature is generally meant to be used during development for testing purposes . ServiceInstaller 类:此功能通常用于在development期间用于testing purposes You use the InstallUtil.exe .NET tool for installation and / or Visual Studio.您使用InstallUtil.exe .NET 工具进行安装和/或 Visual Studio。


Prefer MSI : There are many ways to install services, but you should use the MSI tables ServiceInstall and ServiceControl if you can.首选 MSI :有很多方法可以安装服务,但如果可以的话,您应该使用 MSI 表ServiceInstallServiceControl Below are some further details on various more or less crazy options.以下是有关各种或多或少疯狂选项的更多详细信息。


Service Registration Options : An old, classic document from Phil Wilson ( MSI MVP and author of "The Definitive Guide to Windows Installer" ) listed a number of ways to install services by means of:服务注册选项:来自Phil WilsonMSI MVP"The Definitive Guide to Windows Installer"作者)的一份古老的经典文档列出了多种安装服务的方法:

  • 1) MSI - ServiceInstall , ServiceControl tables - and a few others. 1) MSI - ServiceInstallServiceControl表 - 和其他一些。
  • 2) Win32 - CreateService APIs. 2) Win32 - CreateService API。
  • 3) Registry - manually update, generally an undesirable "under-the-hood" option. 3)注册表- 手动更新,通常是不受欢迎的“幕后”选项。
  • 4) WMI Classes - Win32_Service . 4) WMI 类- Win32_Service Major benefit: Scriptable .主要好处:可编写脚本 Wraps CreateService (Win32).包装CreateService (Win32)。
  • 5) InstallUtil.exe - .NET tool & installer classes. 5) InstallUtil.exe - .NET 工具和安装程序类。
  • 6) MSI & Installer Class Custom Actions - calls InstallUtil.exe via the shim dll InstallUtilLib.Dll in Visual Studio Setup Projects - not a favorite option of mine. 6) MSI 和安装程序 Class 自定义操作- 通过 shim dll InstallUtilLib.Dll在 Visual Studio 安装项目中调用InstallUtil.exe - 不是我最喜欢的选项。 A lot of complexity for no gain basically.很多复杂性基本上没有任何收获。 Just use the service tables in the MSI.只需使用 MSI 中的服务表。 Automagic.自动的。

InstallUtil.exe : When .NET arrived, a tool called InstallUtil.exe was introduced together with a set of installer classes in the .NET framework. InstallUtil.exe :当 .NET 到来时,在 .NET 框架中引入了一个名为 InstallUtil.exe 的工具以及一组安装程序类。 The ServiceInstaller framework class contains code to install Services, and the developer can override the class methods to provide extra install-time code. ServiceInstaller 框架 class 包含安装服务的代码,开发人员可以覆盖 class 方法以提供额外的安装时代码。 This provides a useful way for developers to easily install Services for testing purposes.这为开发人员轻松安装服务以进行测试提供了一种有用的方法。


Many years later one could add to Phil's list:多年后,Phil 的名单中可以添加以下内容:

More exotic: Srvany (run app as service, very outdated - don't use).更具异国情调:Srvany(将应用程序作为服务运行,非常过时 - 不要使用)。


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

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

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