首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未使用ServiceInstall随服务一起安装的性能计数器

未使用ServiceInstall随服务一起安装的性能计数器
EN

Stack Overflow用户
提问于 2011-02-25 02:40:03
回答 1查看 623关注 0票数 0

我有一个NT服务,它有一些性能计数器。当我使用installutil部署服务时,性能计数器和服务安装得很好。当我使用我的msi进行部署时,也就是使用ServiceInstall,服务会显示出来,但是性能计数器没有安装。

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

Wix段

代码语言:javascript
复制
<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计数器安装

代码语言:javascript
复制
[RunInstallerAttribute(true)]
[RegistryPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[EnvironmentPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public sealed class CountersInstaller : Installer
{
    public CountersInstaller()
    {
        Installers.AddRange(Counters.Instance.PerformanceCounterInstallers());
    }
}
EN

回答 1

Stack Overflow用户

发布于 2011-02-25 03:57:35

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

相反,我们来看看PerformanceCategoryPerformanceCounter元素。当然,这将需要一些编码来将您现在使用C#所做的转换为声明性XML形式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5108984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档