Solution to disabled process performance counters

Source: Internet
Author: User

Unprocessed exception: process performance counters disabled

Debugging error:

Unprocessed exception: System. InvalidOperationException: The process performance counter is disabled, so the requested operation cannot be performed.

Solution:

Method 1:

In this case, you only need to fix windows performance counters.

Specific Method: Enter lodctr/r in the running process and press Enter. After running, restart the computer.

Method 2:

Modify registry information

The key value Disable Performance Counters under HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/PerfProc/Performance is set to 0. Restart!

Use C # programming to set the Disable Performance Counters key value to 0"

Using Microsoft. Win32;

Private void Button7_Click (object sender, System. EventArgs e)

{

RegistryKey hklm = Registry. LocalMachine;

RegistryKey software = hklm. OpenSubKey ("SYSTEM // CurrentControlSet // Services // PerfProc", true );

RegistryKey myKey = software. OpenSubKey ("Performance", true );

MyKey. SetValue ("Disable Performance Counters", 0 );

}

The current user is required to be the administrator of the local machine; otherwise, the registry cannot be modified.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.