Perf计数器不使用ServiceInstall安装服务

我有一个NT服务,有一些性能计数器。当我使用installutil部署服务时,perf计数器和服务安装正常。当我使用我的使用ServiceInstall的msi进行部署时,服务会显示,但不会安装perf计数器。 我总是假设ServiceInstall运行了installutil。是否存在一些阻碍我安装perf计数器的重要区别? Wix细分市场
<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' />
Perf计数器安装
[RunInstallerAttribute(true)]
[RegistryPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[EnvironmentPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public sealed class CountersInstaller : Installer
{
    public CountersInstaller()
    {
        Installers.AddRange(Counters.Instance.PerformanceCounterInstallers());
    }
}
    
已邀请:
不,你的假设是不正确的。 ServiceInstall不会调用InstallUtil来安装性能计数器。使用InstallUtil通常被视为一种不好的做法。 相反,请查看PerformanceCategory和PerformanceCounter元素。当然,这需要一些编码来将您现在使用C#转换为声明性XML形式。     

要回复问题请先登录注册