Remove addition of default address to IServerAddressesFeature when none is specified

This commit is contained in:
John Luo 2017-02-28 15:49:33 -08:00
parent 8ea2edee77
commit c8003c0305
2 changed files with 2 additions and 9 deletions

View File

@ -238,12 +238,6 @@ namespace Microsoft.AspNetCore.Hosting.Internal
addresses.Add(value); addresses.Add(value);
} }
} }
if (addresses.Count == 0)
{
// Provide a default address if there aren't any configured.
addresses.Add("http://localhost:5000");
}
} }
} }
} }

View File

@ -67,12 +67,11 @@ namespace Microsoft.AspNetCore.Hosting
} }
[Fact] [Fact]
public void CanDefaultAddressesIfNotConfigured() public void NoDefaultAddressesIfNotConfigured()
{ {
var host = CreateBuilder().UseServer(this).Build(); var host = CreateBuilder().UseServer(this).Build();
host.Start(); host.Start();
Assert.NotNull(host.Services.GetService<IHostingEnvironment>()); Assert.Equal(false, host.ServerFeatures.Get<IServerAddressesFeature>().Addresses.Any());
Assert.Equal("http://localhost:5000", host.ServerFeatures.Get<IServerAddressesFeature>().Addresses.First());
} }
[Fact] [Fact]