Process.GetProcessesByName throws exception

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Process.GetProcessesByName throws exception

    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.asp x.cs Line:
    24

    Stack Trace:


    [Win32Exception (0x80004005): Access is denied]
    System.Diagnostics.PerformanceMonitor.GetData(Stri ng item) +496
    System.Diagnostics.PerformanceCounterLib.GetPerfor manceData(String item)
    +158
    System.Diagnostics.PerformanceCounterLib.get_Categ oryTable() +80
    System.Diagnostics.PerformanceCounterLib.GetPerfor manceData(String[]
    categories, Int32[] categoryIndexes) +56
    System.Diagnostics.NtProcessManager.GetProcessInfo s(PerformanceCounterLib
    library) +157

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







    howard39@nospam.nospam Guest

  2. Similar Questions and Discussions

    1. MapPath throws exception
      I created the following method in a webservice on my localmachine web host to test MapPath because it throws an exception in another method: ...
    2. Web Service Calling a COM object-throws exception.
      I'm trying to write a web service that calls a COM object located on the same machine as the web server, and I'm running into a strange problem. ...
    3. Problem: Process.GetProcessesByName : Couldn't get process information from remote machine
      As part of an ASP.NET application, I am creating an Excel spreadsheet using my .NET component. On my machine (win2K) I always get a...
    4. Web Service throws exception during Application_Start
      We have some static information load from web.config during the application_start of our web service. However, if there is an error during this...
    5. SOAP4R throws exception on copyright character
      Lots of web pages contain copyright characters (not © but something that displays in Mozilla view source as the copyright symbol, in emacs as...
  3. #2

    Default RE: Process.GetProcessesByName throws exception

    The problem was that a new network security policy applied over the weekend
    removed the ASPNET account from the local Administrators group. On Windows
    2000 you have to be in the Administrators group in order for
    GetProcessesByName to work.

    When I added ASPNET back in to the Administrators group, I didn't reset IIS,
    and so I failed to see that GetProcessesByName was now working.
    howard39@nospam.nospam Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139