Process performance counter is disabled

M

Max

I'm trying to get the process id of some application and I get an error for this line:

Process [] myApplications= Process.GetProcessesByName("MyApplication");

The error says:

System.InvalidOperationException: Process performance counter is disabled, so the requested operation cannot be performed.
at System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib library)
at System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)
at System.Diagnostics.Process.GetProcessesByName(String processName, String machineName)
at System.Diagnostics.Process.GetProcessesByName(String processName)

How can I enable the performance counters? Is this required on all computers on which my application will run?

Cheers,
Max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top