【问题标题】:Failure in delete performance counter category删除性能计数器类别失败
【发布时间】:2012-12-16 15:00:23
【问题描述】:

我有这个简单的代码:

public void CreateCounters() {
    if (PerformanceCounterCategory.Exists(_categoryName)) {
        PerformanceCounterCategory.Delete(_categoryName);
    }

    // create logic…
}

在我的机器上工作。 我在我的服务器上运行它,得到以下堆栈跟踪:

System has detected a fatal error. EXITING... 
NativeErrorCode: 1010 
ErrorCode: -2147467259 
Message: The configuration registry key is invalid 
TargetSite: Void RegisterFiles(System.String, Boolean) 
HelpLink:  
Source: System 
Stack Trace: 
 at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister) 
 at System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName) 
 at myApp.Common.Utils.PerformanceCounters.PerformanceCounters.CreateCounters() 
 at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.Init() 
 at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.get_Instance() 
 at myApp.Program.Main(String[] args) 

该类别存在于服务器上,我可以在perfmon GUI 中看到它。

【问题讨论】:

  • 这可能是权限问题吗?
  • 是您创建的性能计数器类别_categoryName 还是预定义的类别之一?
  • 这是我创建的自定义类别名称。我不确定这是否是权限问题(不是暗示),但我在管理权限下运行...

标签: c# performancecounter perfmon


【解决方案1】:

好的,这是性能计数器机制中的一些错误,应通过以下脚本修复:

cd %systemroot%\system32
lodctr /R

查看此链接:http://geekswithblogs.net/robz/archive/2008/08/10/possible-performance-counter-corruption-or-performance-counters-are-just-disabled.aspx

【讨论】:

    猜你喜欢
    • 2010-09-13
    • 2010-10-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2011-03-18
    • 2011-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多