PerformanceCounters on .NET 4.0 & Windows 7

前端 未结 1 464
生来不讨喜
生来不讨喜 2020-12-07 17:04

I have a program that works fine on VS2008 and Vista, but I\'m trying it on Windows 7 and VS2010 / .NET Framework 4.0 and it\'s not working. Ultimately the problem is that S

相关标签:
1条回答
  • 2020-12-07 18:04

    It seems performance counters were corrupted on my system. Although I didn't follow this post exactly, it led me to the solution. Here is what I did:

    In an command prompt with administrator/elevate privileges typed the following:

    lodctr /?
    

    Useful stuff in there...

    Then typed:

    lodctr /R
    

    According to the docs from the prior step, this gets windows to rebuild the perf registry strings and info from scratch based on the current registry settings and backup INI files. I have a feeling this is what did the magic. However, next I noticed the .NET performance counters were not there anymore so based on this I typed the following to reload them:

    lodctr "C:\Windows\Microsoft.NET\Framework64\v4.0.20506\corperfmonsymbols.ini"
    

    Note that this path is for .NET Framework 4.0 on x64. You can imagine the path for other variations of the framework/platform. I'm guessing you should always load the counters from the highest version of the .NET framework that you have installed, but that is just a guess.

    I hope this helps someone else someday!

    0 讨论(0)
提交回复
热议问题