Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Process.GetProcessesByName throws exception

Reply
Thread Tools

Process.GetProcessesByName throws exception

 
 
howard39@nospam.nospam
Guest
Posts: n/a
 
      10-26-2004
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







 
Reply With Quote
 
 
 
 
howard39@nospam.nospam
Guest
Posts: n/a
 
      10-26-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When MailMessage.BodyFormat = MailFormat.Html, SmtpMail.Send throws exception Aren Cambre ASP .Net 5 01-09-2009 07:20 PM
Is an exception specification needed if the method throws and catchesits own exception? elcapitan666@gmail.com C++ 2 11-27-2007 04:01 AM
Re: session.abandon throws 'invalid view state' exception in netscape Cowboy \(Gregory A. Beamer\) ASP .Net 1 05-16-2004 02:31 AM
Exception Exception is not compatible with throws clause in Runnable.run() Chris Miller Java 4 11-22-2003 03:11 PM
XmlValidatingReader throws exception for SAOP-ENV:encodingStyle attribute Himmat Dhange ASP .Net 0 08-26-2003 08:28 PM



Advertisments