diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/Properties/launchSettings.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/Properties/launchSettings.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/Properties/launchSettings.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/EmptyWeb-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/EmptyWeb-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/EmptyWeb-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/EmptyWeb-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-FSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-FSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-FSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/StarterWeb-FSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-FSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-FSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-FSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/WebApi-FSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Properties/launchSettings.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Properties/launchSettings.json index 0dd1d3c232..55e2d059a8 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Properties/launchSettings.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Properties/launchSettings.json @@ -21,7 +21,6 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "ASPNETCORE_HTTPS_PORT": "44300", "ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080" } } diff --git a/test/Templates.Test/Helpers/AspNetProcess.cs b/test/Templates.Test/Helpers/AspNetProcess.cs index 428638b761..de24d4aa70 100644 --- a/test/Templates.Test/Helpers/AspNetProcess.cs +++ b/test/Templates.Test/Helpers/AspNetProcess.cs @@ -9,7 +9,6 @@ using Microsoft.Extensions.CommandLineUtils; using Xunit; using Xunit.Abstractions; using Microsoft.AspNetCore.Certificates.Generation; -using System.Threading; namespace Templates.Test.Helpers { @@ -23,8 +22,6 @@ namespace Templates.Test.Helpers private readonly Uri _listeningUri; private readonly HttpClient _httpClient; private readonly ITestOutputHelper _output; - private readonly int _httpsPort; - private readonly int _httpPort; public AspNetProcess(ITestOutputHelper output, string workingDirectory, string projectName, string targetFrameworkOverride, bool publish) { @@ -62,12 +59,9 @@ namespace Templates.Test.Helpers .WaitForExit(assertSuccess: true); } - _httpPort = Interlocked.Increment(ref Port); - _httpsPort = Interlocked.Increment(ref Port); var envVars = new Dictionary { - { "ASPNETCORE_URLS", $"http://localhost:{_httpPort};https://localhost:{_httpsPort}" }, - { "ASPNETCORE_HTTPS_PORT", $"{_httpsPort}" } + { "ASPNETCORE_URLS", $"http://localhost:127.0.0.0:0;https://localhost:127.0.0.0:0" } }; if (!publish) @@ -99,8 +93,14 @@ namespace Templates.Test.Helpers // Verify we have a valid URL to make requests to var listeningUrlString = listeningMessage.Substring(ListeningMessagePrefix.Length); - _listeningUri = new Uri(listeningUrlString, UriKind.Absolute); output.WriteLine($"Detected that ASP.NET application is accepting connections on: {listeningUrlString}"); + listeningUrlString = listeningUrlString.Substring(0, listeningUrlString.IndexOf(':')) + + "://localhost" + + listeningUrlString.Substring(listeningUrlString.LastIndexOf(':')); + + output.WriteLine("Sending requests to " + listeningUrlString); + + _listeningUri = new Uri(listeningUrlString, UriKind.Absolute); } public void AssertOk(string requestUrl)