[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 849
  • Last Modified:

System.Diagnostics.Process.GetProcesses Error Message

Hello everyone,

I've been getting this error message when I try to execute this code:

System.Diagnostics.Process.GetProcesses()

So far, I've granted the ASPNET user account access to the performance counter group because I was getting an Access Denied error, that is fixed and now I get this error:

Process performance counter is disabled, so the requested operation cannot be performed.

I've been trying to figure out how to enabled the process performance counter but I can't figure it out.

Can anyone show me how to do this?
0
quanmac
Asked:
quanmac
  • 3
  • 2
1 Solution
 
TornadoVCommented:
Microsoft recommended an only workaround which is to add the user to Performance Counter Users Group
http://msdn.microsoft.com/netframework/programming/bcl/faq/SystemDiagnosticsProcessFAQ.aspx#Question7
0
 
quanmacAuthor Commented:
The Performance Counter Users Group is missing from my list of groups.

I have:

Performance Logs Users
and
Performance Monitor Users

I've added the account to both of these and I still get the error:

Process performance counter is disabled, so the requested operation cannot be performed.
0
 
TornadoVCommented:
The ASPNET account (configured by default) impersonated by the worker process has no privileges to access this API. You should use a higher
privilege account with the required permissions. Unfortunately, this goes against the principle of the low privilege account (ASPNET account is a good sample of this), so one thing you could do, is to authenticate the site with an administrator like account or any account with the required privileges, and use impersonation true in the web.config file. This way, nobody with the required permissions will be able to access restricted resources.

You could do that, say in the web.config or the machine.config
file. You might want to check out this article:

306158.KB.EN-US INFO: Implementing Impersonation in an ASP.NET Application

http://support.microsoft.com/?id=306158

You could also take a look at this article for more infor on the process
identity used by asp.net:

317012.KB.EN-US INFO: Process and Request Identity in ASP.NET

http://support.microsoft.com/?id=317012

0
 
quanmacAuthor Commented:
So if i impersonate an account with the required priviledges, then wouldn't be able to access anything else except for the web app?

I am worried that someone would be able to gain access to the OS and manipulate it.
0
 
quanmacAuthor Commented:
Am I able to impersonate an account in my C# code and run the System.Diagnostics.Process.GetProcesses() line and then revert back to the ASPNET account?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now