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

我使用的是 C # 和 WPF-操作系统是 Windows7专业版和 VisualStudio2012,SQLServer2012。

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

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

这个例外是什么意思?

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

谢谢, 安妮。

54942 次浏览

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

Click Start, type cmd right click cmd.exe, and select Run as administrator. At the prompt, type lodctr /r and press 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 /r rebuilds that cache.

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

you get the error

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

after which you should get

Info: Successfully rebuilt performance counter setting from system backup store

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

  1. Go to Start, type”cmd”.

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

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

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

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

  1. Install the Microsoft Dynamics CRM for Outlook client Update Rollup
  1. Run command prompt as admin.

  2. Type LODCTR /r

  3. Wait a few seconds to discard it Error: Unable to reset the performance counter from the system backup storage. Error code 2.

Retype LODCTR / r this time it is working successfully.