我有一个NT服务,它有一些性能计数器。当我使用installutil部署服务时,性能计数器和服务安装得很好。当我使用我的msi进行部署时,也就是使用ServiceInstall,服务会显示出来,但是性能计数器没有安装。
我总是假设ServiceInstall在幕后运行installutil。是否有一些关键的差异会阻止我安装性能计数器?
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());
}
}发布于 2011-02-25 03:57:35
不,你的假设是不正确的。ServiceInstall不会在幕后调用InstallUtil来安装性能计数器。使用InstallUtil通常被视为一种糟糕的做法。
相反,我们来看看PerformanceCategory和PerformanceCounter元素。当然,这将需要一些编码来将您现在使用C#所做的转换为声明性XML形式。
https://stackoverflow.com/questions/5108984
复制相似问题