简体   繁体   中英

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.

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.

How can I create new performance counters using a WiX installer?

The article you reference refers to WiX v2. It is not obvious however which version of WiX toolset you actually use.

WiX v3 has easy-to-use elements PerformanceCategory and PerformanceCounter . We use it in our .NET web application installer to install performance counters we need.

Hope this helps.

I've never done performance counters in .net so I'd have to understand what the physical deployment requirements are. From there I could help you translate that into WiX with an eye for best practices in mind.

How To: Use Custom Performance Counters

It seems .NET has a regsvr type pattern implemented by some classes in System.Diagnostics. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM