删除性能计数器类别失败 [英] Failure in delete performance counter category

查看:100
本文介绍了删除性能计数器类别失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个简单的代码:

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

    // create logic…
}

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

works on my machine. I run it on my server, get the following stack trace:

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中看到它.

The category exists on the server, I can see it in perfmon GUI.

推荐答案

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

ok this is some error in performance counter mechanis, that should be fixed by the following script :

cd %systemroot%\system32
lodctr /R

查看此链接: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆