简体   繁体   中英

Performance counters compatibility with .Net Core

Is there any nuget packages or helpers for controlling custom performance counters in .Net Core? I'm using System.Diagnostics.PerformanceCounter package.

Visual Studio has PerfWatson2 (Developer Analytics Tools) extension which runs when debugging so I'm able to change counters values.

But if I install that code as a service on that machine and start it, Performance counters values does not change (always zero). Service user is added to "Performance Monitor Users".

If I add service user to "Administrators" group. Then performance counters works.

Maybe "Performance Monitor Users" group is not working with .Net Core? I don't want to run service with admin rights because of performance counters.

Tried Microsoft.Windows.Compatibility nuget package but still no luck.. https://blogs.msdn.microsoft.com/dotnet/2017/11/16/announcing-the-windows-compatibility-pack-for-net-core/

Unfortunately the person who ported the System.Diagnostics.PerformanceCounter nuget package removed the line that set's the correct permissions on the memory mapped file for the perf counters. If you look at SharedPerformanceCounter.Initialize, the original line "sECURITY_ATTRIBUTES.lpSecurityDescriptor = pSecurityDescriptor;" has been removed in the port.

此问题已解决 - 已将修复程序合并到https://github.com/dotnet/runtime

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