1-) C# RMOS - end task all process görev yöneticindeki uygulamayı kapatmak
cmd yönetici çalıştır ve -> taskkill /f /t /im w3wp.exe
açıklama : görev yöneticisindeki w3wp.exe'yi aşağıdaki gibi kapatırız
1- EN İYİSİ BU CUNKU YONETICI İZNİ VEREREK CALISTIRIR
public void tumApiTaskKil()
{
try
string path = "apistop.bat";
if (!File.Exists(path))
File.WriteAllText("apistop.bat", "taskkill /f /t /im w3wp.exe");
}
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo(path);
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.Verb = "runas";
p.StartInfo = psi;
p.Start();
catch (Exception ex)
File.WriteAllText("HATA.txt", "" + ex.Message);
2- DİĞER (bu calısmaz cunku yonetıcı izni ister)
List<Process> processes = Process.GetProcessesByName("w3wp").ToList();
if (processes != null && processes.Count>0)
foreach (var process in processes)
process.Kill();
kaynak : https://stackoverflow.com/questions/27382451/how-to-end-a-process-using-c-sharp