diff --git a/src/Servers/FunctionalTests.sln b/src/Servers/FunctionalTests.sln index 4a503e5658cb..1c6bf705242d 100644 --- a/src/Servers/FunctionalTests.sln +++ b/src/Servers/FunctionalTests.sln @@ -25,6 +25,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerComparison.TestSites" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "IIS\IIS\src\Microsoft.AspNetCore.Server.IIS.csproj", "{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IntegrationTesting.IIS", "IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj", "{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.Negotiate", "..\Security\Authentication\Negotiate\src\Microsoft.AspNetCore.Authentication.Negotiate.csproj", "{F3BAB460-05C9-417A-BFDF-4FE93055A915}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication", "..\Security\Authentication\Core\src\Microsoft.AspNetCore.Authentication.csproj", "{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection", "..\DataProtection\DataProtection\src\Microsoft.AspNetCore.DataProtection.csproj", "{81827F08-E8C8-4366-8E0D-6F2C832371F1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Abstractions", "..\DataProtection\Abstractions\src\Microsoft.AspNetCore.DataProtection.Abstractions.csproj", "{AA9993DE-EE40-4884-AA5B-1A5AB630B123}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.Internal", "..\DataProtection\Cryptography.Internal\src\Microsoft.AspNetCore.Cryptography.Internal.csproj", "{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -153,6 +165,78 @@ Global {5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x64.Build.0 = Release|Any CPU {5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x86.ActiveCfg = Release|Any CPU {5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x86.Build.0 = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|Any CPU.Build.0 = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x64.ActiveCfg = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x64.Build.0 = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x86.ActiveCfg = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x86.Build.0 = Debug|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|Any CPU.ActiveCfg = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|Any CPU.Build.0 = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x64.ActiveCfg = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x64.Build.0 = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x86.ActiveCfg = Release|Any CPU + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x86.Build.0 = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x64.ActiveCfg = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x64.Build.0 = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x86.ActiveCfg = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x86.Build.0 = Debug|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|Any CPU.Build.0 = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x64.ActiveCfg = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x64.Build.0 = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x86.ActiveCfg = Release|Any CPU + {F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x86.Build.0 = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x64.ActiveCfg = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x64.Build.0 = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x86.ActiveCfg = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x86.Build.0 = Debug|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|Any CPU.Build.0 = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x64.ActiveCfg = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x64.Build.0 = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x86.ActiveCfg = Release|Any CPU + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x86.Build.0 = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x64.ActiveCfg = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x64.Build.0 = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x86.Build.0 = Debug|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|Any CPU.Build.0 = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x64.ActiveCfg = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x64.Build.0 = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x86.ActiveCfg = Release|Any CPU + {81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x86.Build.0 = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x64.Build.0 = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x86.Build.0 = Debug|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|Any CPU.Build.0 = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x64.ActiveCfg = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x64.Build.0 = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x86.ActiveCfg = Release|Any CPU + {AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x86.Build.0 = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x64.Build.0 = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x86.Build.0 = Debug|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|Any CPU.Build.0 = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x64.ActiveCfg = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x64.Build.0 = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x86.ActiveCfg = Release|Any CPU + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -166,6 +250,12 @@ Global {9DD063D3-CAE1-49C2-9C24-DE3499E79322} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} {0DD5F47B-EDA3-405A-A2F3-08CB2566E30D} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} {5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {689572FA-D5BA-4C70-94EA-C7CD3C1F2815} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {F3BAB460-05C9-417A-BFDF-4FE93055A915} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {0F15D893-B455-4D44-8F00-AFCA9D90C1BE} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {81827F08-E8C8-4366-8E0D-6F2C832371F1} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {AA9993DE-EE40-4884-AA5B-1A5AB630B123} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} + {DB802A16-1630-4C3D-A366-EB96A2C5AEBC} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F4D963C1-44FE-45AE-9B2A-11CD86C7539F} diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs index b63c2ff2ecee..eb6f2a07ccf2 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs @@ -183,14 +183,10 @@ public async Task AppOfflineDroppedWhileSiteRunning_SiteShutsDown_OutOfProcess() { var deploymentResult = await AssertStarts(HostingModel.OutOfProcess); - // Repeat dropping file and restarting multiple times - for (int i = 0; i < 5; i++) - { - AddAppOffline(deploymentResult.ContentRoot); - await AssertAppOffline(deploymentResult); - RemoveAppOffline(deploymentResult.ContentRoot); - await AssertRunning(deploymentResult); - } + AddAppOffline(deploymentResult.ContentRoot); + await AssertAppOffline(deploymentResult); + RemoveAppOffline(deploymentResult.ContentRoot); + await AssertRunning(deploymentResult); AddAppOffline(deploymentResult.ContentRoot); await AssertAppOffline(deploymentResult); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs index eb4dc7cbac2d..2e3d7f4aa8bc 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs @@ -10,8 +10,10 @@ using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Server.IntegrationTesting.IIS; +using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Testing; using Xunit; namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess @@ -76,7 +78,11 @@ public async Task CheckFailedRequestEvents() AssertFrebLogs(result, new FrebLogItem("ANCM_INPROC_ASYNC_COMPLETION_COMPLETION", "2")); } + // I think this test is flaky due to freb file not being created quickly enough. + // Adding extra logging, marking as flaky, and repeating should help [ConditionalFact] + [Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2570", FlakyOn.Helix.All)] + [Repeat(10)] [RequiresIIS(IISCapability.FailedRequestTracingModule)] public async Task CheckFrebDisconnect() { @@ -120,6 +126,7 @@ private void AssertFrebLogs(IISDeploymentResult result, IEnumerable var frebEvent = GetFrebLogItems(result); foreach (var expectedEvent in expectedFrebEvents) { + result.Logger.LogInformation($"Checking if {expectedEvent.ToString()} exists."); Assert.Contains(expectedEvent, frebEvent); } } @@ -127,9 +134,10 @@ private void AssertFrebLogs(IISDeploymentResult result, IEnumerable private IEnumerable GetFrebLogItems(IISDeploymentResult result) { var folderPath = Helpers.GetFrebFolder(_logFolderPath, result); - var xmlFiles = Directory.GetFiles(folderPath).Where(f => f.EndsWith("xml")); + var xmlFiles = Directory.GetFiles(folderPath).Where(f => f.EndsWith("xml")).ToList(); var frebEvents = new List(); + result.Logger.LogInformation($"Number of freb files available {xmlFiles.Count}."); foreach (var xmlFile in xmlFiles) { var xDocument = XDocument.Load(xmlFile).Root; @@ -174,6 +182,11 @@ public override int GetHashCode() { return HashCode.Combine(_opCode, _requestStatus); } + + public override string ToString() + { + return $"FrebLogItem: opCode: {_opCode}, requestStatus: {_requestStatus}"; + } } } } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/MaxRequestBodySizeTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/MaxRequestBodySizeTests.cs index 79a60814e165..3f03d99318f9 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/MaxRequestBodySizeTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/MaxRequestBodySizeTests.cs @@ -4,7 +4,6 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IIS; using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Server.IntegrationTesting.IIS; @@ -91,6 +90,9 @@ public async Task SetIISLimitMaxRequestBodyLogsWarning() var result = await deploymentResult.HttpClient.PostAsync("/DecreaseRequestLimit", new StringContent("1")); Assert.Equal(HttpStatusCode.OK, result.StatusCode); + + StopServer(); + if (deploymentParameters.ServerType == ServerType.IISExpress) { Assert.Single(TestSink.Writes, w => w.Message.Contains("Increasing the MaxRequestBodySize conflicts with the max value for IIS limit maxAllowedContentLength." + diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs index 6fbd3f6950d4..910b25a84b74 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs @@ -11,7 +11,6 @@ using System.Xml.Linq; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Server.IntegrationTesting.IIS; -using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Xunit; @@ -20,7 +19,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests { public static class Helpers { - private static readonly TimeSpan RetryRequestDelay = TimeSpan.FromMilliseconds(100); + private static readonly TimeSpan RetryRequestDelay = TimeSpan.FromMilliseconds(10); private static readonly int RetryRequestCount = 10; public static string GetInProcessTestSitesName() @@ -105,12 +104,14 @@ public static Task RetryRequestAsync(this HttpClient client public static async Task RetryRequestAsync(this HttpClient client, string uri, Func> predicate) { HttpResponseMessage response = await client.GetAsync(uri); - + var delay = RetryRequestDelay; for (var i = 0; i < RetryRequestCount && !await predicate(response); i++) { // Keep retrying until app_offline is present. response = await client.GetAsync(uri); - await Task.Delay(RetryRequestDelay); + await Task.Delay(delay); + // This will max out at a 5 second delay + delay *= 2; } if (!await predicate(response)) diff --git a/src/Servers/IIS/IIS/test/IIS.Tests/ClientDisconnectTests.cs b/src/Servers/IIS/IIS/test/IIS.Tests/ClientDisconnectTests.cs index a1dbc0f28e8b..4418bb63c1f5 100644 --- a/src/Servers/IIS/IIS/test/IIS.Tests/ClientDisconnectTests.cs +++ b/src/Servers/IIS/IIS/test/IIS.Tests/ClientDisconnectTests.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; @@ -20,19 +19,20 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests public class ClientDisconnectTests : StrictTestServerTests { [ConditionalFact] - [Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2358", FlakyOn.All)] public async Task WritesSucceedAfterClientDisconnect() { var requestStartedCompletionSource = CreateTaskCompletionSource(); - var clientDisconnectedCompletionSource = CreateTaskCompletionSource(); var requestCompletedCompletionSource = CreateTaskCompletionSource(); + var requestAborted = CreateTaskCompletionSource(); var data = new byte[1024]; using (var testServer = await TestServer.Create( async ctx => { requestStartedCompletionSource.SetResult(true); - await clientDisconnectedCompletionSource.Task; + ctx.RequestAborted.Register(() => requestAborted.SetResult(true)); + + await requestAborted.Task.DefaultTimeout(); for (var i = 0; i < 1000; i++) { await ctx.Response.Body.WriteAsync(data); @@ -46,7 +46,8 @@ public async Task WritesSucceedAfterClientDisconnect() await SendContentLength1Post(connection); await requestStartedCompletionSource.Task.DefaultTimeout(); } - clientDisconnectedCompletionSource.SetResult(true); + + await requestAborted.Task.DefaultTimeout(); await requestCompletedCompletionSource.Task.DefaultTimeout(); } @@ -55,7 +56,6 @@ public async Task WritesSucceedAfterClientDisconnect() } [ConditionalFact] - [Repeat(20)] public async Task WritesCanceledWhenUsingAbortedToken() { var requestStartedCompletionSource = CreateTaskCompletionSource(); diff --git a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs index 7d56ec6ce33b..b08ba187384f 100644 --- a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs +++ b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs @@ -264,6 +264,8 @@ private string CheckIfPublishIsRequired() Logger.LogInformation("Started iisexpress successfully. Process Id : {processId}, Port: {port}", _hostProcess.Id, port); return (url: url, hostExitToken: hostExitTokenSource.Token); } + + ChangePort(contentRoot, (uri.Scheme == "https") ? TestPortHelper.GetNextSSLPort() : TestPortHelper.GetNextPort()); } var message = $"Failed to initialize IIS Express after {MaximumAttempts} attempts to select a port"; @@ -274,7 +276,7 @@ private string CheckIfPublishIsRequired() private void PrepareConfig(string contentRoot, int port) { - var serverConfig = DeploymentParameters.ServerConfigTemplateContent;; + var serverConfig = DeploymentParameters.ServerConfigTemplateContent; // Config is required. If not present then fall back to one we carry with us. if (string.IsNullOrEmpty(serverConfig)) { @@ -313,6 +315,14 @@ private void PrepareConfig(string contentRoot, int port) File.WriteAllText(DeploymentParameters.ServerConfigLocation, serverConfig); } + private void ChangePort(string contentRoot, int port) + { + var serverConfig = File.ReadAllText(DeploymentParameters.ServerConfigLocation); + XDocument config = XDocument.Parse(serverConfig); + ConfigureModuleAndBinding(config.Root, contentRoot, port); + File.WriteAllText(DeploymentParameters.ServerConfigLocation, serverConfig); + } + private void AddAspNetCoreElement(XElement config) { var aspNetCore = config