性能计数器 - 性能类别创建错误 [英] Performance Counters - Performance Category creation error

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

问题描述

当我尝试从 ASP.NET 应用程序创建新的性能类别时遇到错误.最初我遇到了一些与注册表相关的问题,但通过向用户授予对某些注册表项的一些权限并将其添加到性能日志用户"和性能监视器用户"组来解决这些问题.但现在我遇到了一个例外,我不知道还能尝试什么.

I am getting an error when I try to create a new Performance Category from my ASP.NET application. Initially I had some registry related issues but they were solved by giving the user some permissions over some registry keys and adding it to the "Performance Log Users" and "Performance Monitor Users" groups. But now I am getting an exception and I don't know what else to try.

执行此行时发生错误:

PerformanceCounterCategory.Create(testName, testDescription, PerformanceCounterCategoryType.Unknown, counters);

testNametestDescriptions 是包含类别名称和描述的字符串变量,而 counters 是 CounterCreationDataCollection有 3 个计数器.

testName and testDescriptions are string variables that contains name and description of the category and counters is a CounterCreationDataCollection with 3 counters.

这是异常的堆栈跟踪:

在 System.Diagnostics.PerformanceCounterLib.RegisterFiles(Stringarg0,布尔注销)在System.Diagnostics.PerformanceCounterLib.RegisterCategory(字符串categoryName、PerformanceCounterCategoryType categoryType、StringcategoryHelp, CounterCreationDataCollection creationData) 在System.Diagnostics.PerformanceCounterCategory.Create(StringcategoryName、String categoryHelp、PerformanceCounterCategoryTypecategoryType, CounterCreationDataCollection counterData) 在CL.Libraries.PerformanceTestUtils.InitializeCounters(List`1usedCounters, String testName, String testDescription) 中C:\CL.Libraries\PerformanceTestUtils.cs:line 104

at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister) at System.Diagnostics.PerformanceCounterLib.RegisterCategory(String categoryName, PerformanceCounterCategoryType categoryType, String categoryHelp, CounterCreationDataCollection creationData) at System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) at CL.Libraries.PerformanceTestUtils.InitializeCounters(List`1 usedCounters, String testName, String testDescription) in C:\CL.Libraries\PerformanceTestUtils.cs:line 104

似乎我无法发布图片,所以这是我得到的:

It seems I cannot post an image so here's what I get:

" UnauthorizedAccessException 被捕获:

" UnauthorizedAccessException was caught:

无法创建或删除性能类别C:\TEMP\tmpD5E8.tmp"因为访问被拒绝."

Cannot create or delete the Performance Category 'C:\TEMP\tmpD5E8.tmp' because access is denied. "

类别键是在注册表中创建的.上面提到的文件被创建,然后被删除.我授予用户对 Temp 文件夹的显式访问权限,但这也无济于事.

The category key is created in the registry. The file referred above is created and then deleted. I gave the user explicit access to the Temp folder but that didn't help either.

非常感谢任何帮助.

推荐答案

您的代码在没有管理权限的情况下执行并且具有试图读取性能计数器.

Your code is is executing without administrative privileges and have attempted to read a performance counter.

您需要管理权限

以上消息摘自 MSDN http://msdn.microsoft.com/en-us/library/sb32hxtc.aspx

The above message is taken from MSDN http://msdn.microsoft.com/en-us/library/sb32hxtc.aspx

这篇关于性能计数器 - 性能类别创建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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