diff --git a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs index 17e30ee84205..9df58352bc24 100644 --- a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs +++ b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs @@ -167,16 +167,9 @@ private string CheckIfPublishIsRequired() Logger.LogInformation("Attempting to start IIS Express on port: {port}", port); PrepareConfig(contentRoot, port); - var parameters = string.IsNullOrEmpty(DeploymentParameters.ServerConfigLocation) ? - string.Format(CultureInfo.InvariantCulture, "/port:{0} /path:\"{1}\" /trace:error /systray:false", uri.Port, contentRoot) : - string.Format(CultureInfo.InvariantCulture, "/site:{0} /config:{1} /trace:error /systray:false", DeploymentParameters.SiteName, DeploymentParameters.ServerConfigLocation); - - Logger.LogInformation("Executing command : {iisExpress} {parameters}", iisExpressPath, parameters); - var startInfo = new ProcessStartInfo { FileName = iisExpressPath, - Arguments = parameters, UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, @@ -185,6 +178,23 @@ private string CheckIfPublishIsRequired() WorkingDirectory = Path.GetDirectoryName(iisExpressPath) }; + if (string.IsNullOrEmpty(DeploymentParameters.ServerConfigLocation)) + { + startInfo.ArgumentList.Add("/port:" + uri.Port.ToString(CultureInfo.InvariantCulture)); + startInfo.ArgumentList.Add("/path:" + contentRoot); + startInfo.ArgumentList.Add("/trace:error"); + startInfo.ArgumentList.Add("/systray:false"); + } + else + { + startInfo.ArgumentList.Add("/site:" + DeploymentParameters.SiteName); + startInfo.ArgumentList.Add("/config:" + DeploymentParameters.ServerConfigLocation); + startInfo.ArgumentList.Add("/trace:error"); + startInfo.ArgumentList.Add("/systray:false"); + } + + Logger.LogInformation("Executing command : {iisExpress} {parameters}", iisExpressPath, string.Join(" ", startInfo.ArgumentList)); + AddEnvironmentVariablesToProcess(startInfo, DeploymentParameters.EnvironmentVariables); Uri url = null;