I am working on a c#/soap/php project where the php web interface will do a soap request to determine if the console application is running.
The soap request calls a function that gets the processes and then loops through to determine if the process name contains EmailServer. However, this is never being found even though I can see the process EmailServer.exe in Task Manager. I’ve also put a breakpoint so I can look through what processes is in the array and EmailServer is not there.
I’m running Windows 7 x64 with .net framework 3.5 and I am logged in as Administrator account so it can’t be a permissions problem.
Below is a screenshot which shows my process running in Task Manager 
Below is the code that gets the process list
public bool checkIfProcessIsRunning()
{
Process[] processes = Process.GetProcesses();
foreach (Process process in processes)
{
if (process.ProcessName.ToLower().Contains("EmailServer"))
{
return true;
}
else
{
return false;
}
}
return false;
}
Thanks for any help you can provide.
You’re checking if an all lowercase string contains a string with uppercase characters.