Repeat
Recurring startup problems can be frustrating sometimes, especially with the socket port for the service, which needs to be registered, and when you start the service, the port is registered, and if it starts again, it's obviously a threat to the application that's started.
If we can have a method that, when the application loads, finds that the program is already running, close the program
private static void Checkrunning ()
{
int proceedingcount = 0;
System.diagnostics.process[] processes;
processes = System.Diagnostics.Process.GetProcessesByName ("MyServer");
foreach (System.Diagnostics.Process isprocedding in processes)
{
if (isprocedding.processname== "Myserve")
{
Proceedingcount + 1;
}
}
if (Proceedingcount > 1)
{
DialogResult result;
Result=messagebox.show ("Service has been opened", "hint", messageboxbuttons.ok,messageboxicon.information);
foreach (System.Diagnostics.Process myprocess in processes)
{
Myprocess.kill ();
}
}
}