[英]How do I create performance counters for a .NET application with a WiX-based installer?
I'm creating a WiX-based installer for my .NET-based website. 我正在为基于.NET的网站创建一个基于WiX的安装程序。
Part of this website involves the performance counters which I would like to create using the installer (counters require elevated permissions to create, something the website should never have). 本网站的一部分涉及我想使用安装程序创建的性能计数器(计数器需要提升权限才能创建,网站应该永远不会有)。
I have read the documentation provided by WiX on the subject of installing counters, however it looks aimed at native-code applications and seems like it's more effort than it's worth. 我已经阅读了 WiX提供的关于安装计数器的文档 ,但是它看起来针对本机代码应用程序,看起来它比它的价值更多的努力。
How can I create new performance counters using a WiX installer? 如何使用WiX安装程序创建新的性能计数器?
The article you reference refers to WiX v2. 您引用的文章是指WiX v2。 It is not obvious however which version of WiX toolset you actually use. 然而,您实际使用的是哪个版本的WiX工具集并不明显。
WiX v3 has easy-to-use elements PerformanceCategory and PerformanceCounter . WiX v3具有易于使用的元素PerformanceCategory和PerformanceCounter 。 We use it in our .NET web application installer to install performance counters we need. 我们在.NET Web应用程序安装程序中使用它来安装我们需要的性能计数器。
Hope this helps. 希望这可以帮助。
I've never done performance counters in .net so I'd have to understand what the physical deployment requirements are. 我从未在.net中完成性能计数器,因此我必须了解物理部署要求是什么。 From there I could help you translate that into WiX with an eye for best practices in mind. 从那里,我可以帮助您将其转化为WiX,并着眼于最佳实践。
How To: Use Custom Performance Counters 如何:使用自定义性能计数器
It seems .NET has a regsvr type pattern implemented by some classes in System.Diagnostics. 似乎.NET有一个由System.Diagnostics中的某些类实现的regsvr类型模式。 You could adapt this code with WiX's DTF to create a custom action to create the performance counters but this doesn't feel quite right. 您可以使用WiX的DTF调整此代码,以创建自定义操作来创建性能计数器,但这感觉不太对。 Also on that web page is some information that says the counters get registered under CurrentControlSet\\Services so it might be possible to just use the Registry tables or ServiceInstall table to do the work without writing a custom action. 此网页上还有一些信息表明计数器已在CurrentControlSet \\ Services下注册,因此可以使用Registry表或ServiceInstall表来完成工作,而无需编写自定义操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.