3
votes

I'm having trouble with an established production .NET2 service. The service collects process information and log files from various target computers. It runs at 80 sites without issue; mostly on Windows 2000, Windows XP, and Windows 2003.

Now, running against a Windows 7 target, an exception happens whenever the service attempts to read process information.

The code looks like:

 Process[] procs = System.Diagnostics.Process.GetProcesses("10.11.12.13");

Info: The target computer responds to ping and the "adminUser" credentials exist on both the target computer and the service computer.

Exception information:

ex {"Couldn't connect to remote machine."} System.Exception {System.InvalidOperationException} [System.InvalidOperationException] {"Couldn't connect to remote machine."} System.InvalidOperationException

Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}

InnerException {"Couldn't get process information from performance counter."} System.Exception {System.InvalidOperationException} [System.InvalidOperationException] {"Couldn't get process information from performance counter."} System.InvalidOperationException

Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}

InnerException {"The network path was not found"} System.Exception {System.ComponentModel.Win32Exception}

Message "Couldn't get process information from performance counter." string

Source "System" string

StackTrace " at System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLiblibrary)\r\n at System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)" string

TargetSite {System.Diagnostics.ProcessInfo[] GetProcessInfos(System.Diagnostics.PerformanceCounterLib)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

Message "Couldn't connect to remote machine." string

To troubleshoot this I disabled the Windows Firewall on the target computer, to no avail. Anyone have any ideas?


If anyone has any suggestions as to which steps and in what order I should be trying I am very appreciative for the assistance.


Update: I executed a "tasklist" command from the monitoring computer, passing the arguments to query the remote (target) computer and I was able to see the same type of process information that I am not able to get programmatically...

The command looked like:

tasklist /s 10.11.12.13

The returned information looked like:

...  
notepad.exe                    672                            1      4,916 K
...  

So, why can't .NET see the process information???

2
Definitely sounds like some sort of access rights issue going to the remote machine. - 500 - Internal Server Error
Thanks for responding. I agree, I just don't know the best way to identify the root issue. - Chorizo Omelet
The network path was not found, the inner-most exception. That's a job for the LAN admin. - Hans Passant

2 Answers

7
votes

Turns out the problem was that the "Remote Registry" service was not running on the target computer!

This explains why whacking the firewall had no effect. Thanks to everyone who offered assistance.

1
votes

Yes, try passing the actual machine name (not the ip address) to the function:

Process.GetProcesses("MyMachineName")

You can type ipconfig /all at the command prompt and look for "Host Name" to know the machine's name.