/// <summary> /// Kill the web server process /// </summary> /// <param name="inst"></param> public static void StopServer(this ITestServer inst) { TestServerIPC.Dispose(); try { if (inst.ServerProcess != null) { inst.ServerProcess.Kill(); // parent process only in .NET Framework, unlike Core inst.ServerProcess.WaitForExit(); } } catch { } finally { inst.ServerProcess.Dispose(); inst.ServerProcess = null; } }
/// <summary> /// Kill the web server process /// </summary> /// <param name="inst"></param> public static void StopServer(this ITestServer inst) { TestServerIPC.Dispose(); try { if (inst.ServerProcess != null) { inst.ServerProcess.Kill(true); // recursive in .NET Core, unlike Framework inst.ServerProcess.WaitForExit(); } } catch { } finally { inst.ServerProcess.Dispose(); inst.ServerProcess = null; } }