Click here to Skip to main content
14,576,147 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,
i'm trying to launch application that works well on Win7, but on Win10 causes an error.

GetProcessesByName with parameter "127.0.0.1| does not work on Win10.

anyone knows why?


static void Main(string[] args)
        {
            try
            {
                Process[] processesByName = Process.GetProcessesByName("vshost32.exe", "127.0.0.1");
                if (processesByName.Length == 0)
                {
                    Console.WriteLine("false");
                }
                else
                {
                    Console.WriteLine("true");
                }
            }
            catch (InvalidOperationException exception)
            {
                Console.WriteLine(exception);
            }

            Console.ReadLine();

        }


error:
DESKTOP-SJPDB4K\Administrator [2020-05-24 18:37:56,286] ERROR - Error checking process status
System.InvalidOperationException: Cannot connect to remote machine. ---> System.InvalidOperationException: Cannot read value from counter performance. ---> System.ComponentModel.Win32Exception: Cannot find remote path.

   w System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)
   w System.Diagnostics.Process.GetProcesses(String machineName)
   w System.Diagnostics.Process.GetProcessesByName(String processName, String machineName)


What I have tried:

i tried many things like
- changing settings of firewall
- disabling firewall
- add a line "127.0.0.1 localhost" to c:\windows\system32\drivers\etc\hosts

nothing helped.
Posted
Updated 1-Jun-20 7:13am
Comments
Maciej Los 1-Jun-20 11:48am
   
Does Win10 is 32 or 64bit?
Member 14850091 1-Jun-20 12:32pm
   
System is 64bit, application is 32bits
Maciej Los 1-Jun-20 12:45pm
   
This might be the reason. Have you tried to compile your programme with different options (32/64bit)?
Richard MacCutchan 1-Jun-20 12:56pm
   
Why are you using the IP address of your own machine? Use the version of GetProcessesByName that does not require a hostname.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100