public IISExpressHarness(string projectPath, int serverPort, IISExpressBitness bitness = IISExpressBitness.x86, bool showWindow = false) { string fullName = new DirectoryInfo(Path.Combine(projectPath, "Web.config")).FullName; if (!File.Exists(fullName)) { throw new Exception($"No Web.config file found in the project path directory ({fullName})."); } if (serverPort < 1 || serverPort > ushort.MaxValue) { throw new ArgumentOutOfRangeException($"The server port is invalid."); } ProjectPath = projectPath; ServerPort = serverPort; Bitness = bitness; ShowWindow = showWindow; PIDUtilities.KillByPID("pid.txt", "iisexpress"); ProcessStartInfo startInfo = CreateServerStartInfo(); ServerProcess = StartServer(startInfo); PIDUtilities.StorePID("pid.txt", ServerProcess.Id); }
public DotNetCoreHarness(string projectPath, int serverPort, string hostingEnvironment) { string fullName = new DirectoryInfo(Path.Combine(projectPath, "project.json")).FullName; if (!File.Exists(fullName)) { throw new Exception($"No project.json file found in the project path directory ({fullName})."); } if (serverPort < 1 || serverPort > ushort.MaxValue) { throw new ArgumentOutOfRangeException($"The server port is invalid."); } ProjectPath = projectPath; ServerPort = serverPort; HostingEnvironment = hostingEnvironment; PIDUtilities.KillByPID("pid.txt", "dnx"); ProcessStartInfo startInfo = CreateServerStartInfo(); ServerProcess = StartServer(startInfo); PIDUtilities.StorePID("pid.txt", ServerProcess.Id); }