C# 无法加载计数器名称数据,因为索引无效 - 异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17980178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 10:58:12  来源:igfitidea点击:

Cannot load Counter Name data because an invalid index -Exception

c#.netsql-server-2012

提问by Annie Sheikh

I am using C# and WPF - Operating System is windows 7 Professional and Visual Studio 2012, SQL Server 2012.

我正在使用 C# 和 WPF - 操作系统是 windows 7 Professional 和 Visual Studio 2012、SQL Server 2012。

I used Devexpress Grid in wpf. I want to bind it to database using ADO.Net Server mode. I selected "Items Source Wizard" Option to do this binding but it generated following Exception:

我在 wpf 中使用了 Devexpress Grid。我想使用 ADO.Net 服务器模式将它绑定到数据库。我选择了“项目源向导”选项来执行此绑定,但它生成了以下异常:

InvalidOperationException: Cannot load Counter Name data because an invalid index '' was read from the registry.

InvalidOperationException:无法加载计数器名称数据,因为从注册表中读取了无效索引“”。

What does this exception mean?

这个异常是什么意思?

Can you please help me to resolve this issue.

你能帮我解决这个问题吗?

Thanks, Annie.

谢谢,安妮。

回答by Pablissimo

Just had that message related to Microsoft Dynamics CRM updates not installing and the marked answer for this posthelped greatly:

刚刚收到与未安装 Microsoft Dynamics CRM 更新相关的消息,这篇文章的标记答案有很大帮助:

Click Start, type cmd right click cmd.exe, and select Run as administrator. At the prompt, type lodctr /rand press ENTER.

单击开始,键入 cmd 右键单击​​ cmd.exe,然后选择以管理员身份运行。在提示符下,键入lodctr /r并按 ENTER。

Apparently, Windows keeps some counters cache in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\ Counter+Help. If this cache becomes corrupted (has blank lines), you get the above errors - and lodctr /rrebuilds that cache.

显然,Windows 在注册表中保留了一些计数器缓存在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\ Counter+ 处Help。如果此缓存损坏(有空行),则会出现上述错误 - 并lodctr /r重建该缓存。

回答by tdc

Although this has already been answered, I see people are repeatedly getting the same error that I did when trying to solve it. If when you run:

尽管这已经得到了回答,但我看到人们在尝试解决它时反复遇到与我相同的错误。如果运行时:

C:\windows\system32> lodctr /r

C:\windows\system32> lodctr /r

you get the error

你得到错误

Error: Unable to rebuild performance counter setting from system backup store, error code is 2

Error: Unable to rebuild performance counter setting from system backup store, error code is 2

then you instead need to run

那么你需要运行

C:\windows\SysWOW64> lodctr /r

C:\windows\SysWOW64> lodctr /r

after which you should get

之后你应该得到

Info: Successfully rebuilt performance counter setting from system backup store

Info: Successfully rebuilt performance counter setting from system backup store

Note this has to be done as administrator. I found the solution here

请注意,这必须以管理员身份完成。我在这里找到了解决方案

回答by Zia Ul Mustafa

  1. Go to Start, type”cmd”.

  2. Right-click on cmd.exe and choose ‘Run as administrator'.

  3. Type “lodctr /r” and press enter.

  1. 转到开始,键入“cmd”。

  2. 右键单击 cmd.exe 并选择“以管理员身份运行”。

  3. 输入“lodctr /r”并按回车键。

You will then get the message ‘Info: Successfully rebuilt performance counter setting from system backup store'.

然后,您将收到消息“信息:已成功从系统备份存储重建性能计数器设置”。

  1. Check if there are providers that are disabled, write “lodctr /q” and press enter

  2. You will then get a long list of providers, make sure that the [CRM Client] is Enabled, see below

  1. 检查是否有禁用的提供程序,写入“lodctr /q”并按回车

  2. 然后您将获得一长串供应商列表,确保 [CRM Client] 已启用,见下文

If not, write “lodctr /e:CRM Client” and press enter.

如果没有,请输入“lodctr /e:CRM Client”并按回车键。

  1. Install the Microsoft Dynamics CRM for Outlook client Update Rollup
  1. 安装 Microsoft Dynamics CRM for Outlook 客户端更新汇总