diff --git a/src/Microsoft.AspNetCore.Server.IISIntegration/WebHostBuilderIISExtensions.cs b/src/Microsoft.AspNetCore.Server.IISIntegration/WebHostBuilderIISExtensions.cs index 2a09eed46b..8a92946ae1 100644 --- a/src/Microsoft.AspNetCore.Server.IISIntegration/WebHostBuilderIISExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.IISIntegration/WebHostBuilderIISExtensions.cs @@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Hosting } } - var address = "http://localhost:" + port; + var address = "http://127.0.0.1:" + port; hostBuilder.CaptureStartupErrors(true); hostBuilder.ConfigureServices(services => diff --git a/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/IISMiddlewareTests.cs b/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/IISMiddlewareTests.cs index d282c07c10..0898b7ae21 100644 --- a/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/IISMiddlewareTests.cs +++ b/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/IISMiddlewareTests.cs @@ -252,7 +252,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration // Adds a server and calls Build() var server = new TestServer(builder); - Assert.Equal("http://localhost:12345", builder.GetSetting(WebHostDefaults.ServerUrlsKey)); + Assert.Equal("http://127.0.0.1:12345", builder.GetSetting(WebHostDefaults.ServerUrlsKey)); Assert.Equal("true", builder.GetSetting(WebHostDefaults.PreferHostingUrlsKey)); } @@ -270,7 +270,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration }); new TestServer(builder); - Assert.Equal("http://localhost:12345", builder.GetSetting(WebHostDefaults.ServerUrlsKey)); + Assert.Equal("http://127.0.0.1:12345", builder.GetSetting(WebHostDefaults.ServerUrlsKey)); } [Fact]