【问题标题】:Perf counters not installing with service using ServiceInstall性能计数器未使用 ServiceInstall 安装服务
【发布时间】:2011-02-24 18:40:03
【问题描述】:

我有一个 NT 服务,它有一些性能计数器。当我使用 installutil 部署服务时,性能计数器和服务安装正常。当我使用使用 ServiceInstall 的 msi 进行部署时,会显示该服务,但未安装性能计数器。

我总是假设 ServiceInstall 在幕后运行 installutil。是否有一些关键差异会阻止我安装性能计数器?

蜡段

<ServiceInstall Id='ServiceInstall' ErrorControl='ignore' Type='ownProcess' DisplayName='Service' Description='service' Name='Service' Start='auto' Account='[SERVICEACCOUNT]' Password='[SERVICEACCOUNTPASSWORD]' /> 
<ServiceControl Id='Service' Remove='uninstall' Name='Service' Start='install' Stop='both' Wait='yes' />

性能计数器安装

[RunInstallerAttribute(true)]
[RegistryPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[EnvironmentPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public sealed class CountersInstaller : Installer
{
    public CountersInstaller()
    {
        Installers.AddRange(Counters.Instance.PerformanceCounterInstallers());
    }
}

【问题讨论】:

    标签: wix wix3 performancecounter serviceinstall


    【解决方案1】:

    不,您的假设不正确。 ServiceInstall 不会在后台调用 InstallUtil 来安装性能计数器。使用 InstallUtil 通常被视为一种不好的做法。

    相反,请查看 PerformanceCategoryPerformanceCounter 元素。当然,这需要一些编码来将您现在使用 C# 执行的操作转换为声明性 XML 形式。

    【讨论】:

    • 我很好奇。如果我的服务已经在使用某个版本的 .Net 框架,为什么调用 InstallUtil 会如此糟糕?它不会添加任何不存在的其他依赖项,在这种情况下它简化了部署。
    • 查看与 WiX Toolset 一起安装的 dtf.chm 文件。其中包含一篇名为“InstallUtil Notes”的文章。它给出了一些基本的想法。此外,您可能有兴趣查看此讨论:stackoverflow.com/questions/3241377/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-09
    • 2023-02-09
    • 2010-11-06
    • 1970-01-01
    • 2013-06-17
    • 1970-01-01
    相关资源
    最近更新 更多