Process.GetProcessesByName throws exception

howard39_at_nospam.nospam
Date: 10/26/04


Date: Mon, 25 Oct 2004 17:17:02 -0700

We a Web application that has been running for months, but suddenly (i.e.
over the weekend) stopped working.

To narrow down the problem, I wrote the followng page_load handler in an
ASP.Net test application:

public void Page_Load(Object sender, EventArgs e)
{
    Process currentProcess = Process.GetCurrentProcess();
    Process [] localByName = Process.GetProcessesByName("notepad");
}

GetCurrentProcess works, but GetProcessesByName throws the exception that I
have appended to this message.

The same code in a Console application works fine. The ASP.Net worker
process is a member of the User group. However changing it to Administrator
does not help. Nor does changing to Impersonation. Nor does including the
name of my machine in GetProcessesByName.

Would apreciate help on this.

THE EXCEPTION MESSAGE (Note the "Couldn't get process information from
remote machine" exception):

Exception Details: System.ComponentModel.Win32Exception: Access is denied

Source Error:

Line 22: {
Line 23: Process currentProcess = Process.GetCurrentProcess();
Line 24: Process [] localByName = Process.GetProcessesByName("notepad");
         
Line 25: }
Line 26:
 

Source File: c:\inetpub\wwwroot\testwebapplication\webform1.aspx.cs Line:
24

Stack Trace:

[Win32Exception (0x80004005): Access is denied]
   System.Diagnostics.PerformanceMonitor.GetData(String item) +496
   System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
+158
   System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +80
   System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String[]
categories, Int32[] categoryIndexes) +56
   System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
library) +157

[InvalidOperationException: Couldn't get process information from remote
machine.]
   System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
library) +259
   System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName,
Boolean isRemoteMachine) +152
   System.Diagnostics.ProcessManager.GetProcessInfos(String machineName) +37
   System.Diagnostics.Process.GetProcessesByName(String processName, String
machineName) +69
   System.Diagnostics.Process.GetProcessesByName(String processName) +11
   TestWebApplication.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testwebapplication\webform1.aspx.cs:24
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

 



Relevant Pages

  • Configuration Error
    ... Im having a problem I cant solve atm. ... Source Error: ... Please review the stack trace for more ... Exception Details: System.Threading.ThreadAbortException: Thread was ...
    (microsoft.public.dotnet.general)
  • WMI Access Is Denied Exception on XP SP2 even with firewall off
    ... WMI StopService 'Access Is Denied' Exception ... on a remote machine (in this case one running embedded XP SP1, ... Windows XP SP2, I get the exception 'Access is Denied'. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Problems accessing the ASPNETDB.MDF file
    ... development machine, but after deployment I can't log in anymore. ... "Source Error: ... the exception can be identified using the exception stack trace below. ... I see no reason for pasting in the stack trace. ...
    (microsoft.public.dotnet.security)
  • Problem accessing QueryEx or any methods of the Query Service Web service
    ... Calling any of the methods to Query Service is generating exception. ... Please review the stack trace for more information about the error and where it originated in the code. ... Source Error: ... System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) ...
    (microsoft.public.sharepoint.portalserver)
  • System does not match the assembly reference.
    ... An unhandled exception occurred during the execution of the ... Source Error: ... System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder ...
    (microsoft.public.dotnet.framework.aspnet)