Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

[Discussion] Hosting no longer adds default server address when no address is explicitly configured #956

Closed
JunTaoLuo opened this issue Mar 3, 2017 · 3 comments

Comments

@JunTaoLuo
Copy link
Contributor

JunTaoLuo commented Mar 3, 2017

Discussion for aspnet/Announcements#224.

@natemcmaster
Copy link
Contributor

Can you clarify what changes developers should make in their apps to react to this change?

@JunTaoLuo
Copy link
Contributor Author

Our servers have been updated in aspnet/HttpSysServer#297 and aspnet/HttpSysServer#297 so if Kestrel or HttpSysServer is being used, no changes are required.

If you are implementing a server and rely on the IServerAddressesFeature to be set by hosting, that will no longer be set and a default should be added when no address is configured. As an example:

var serverFeatures = featureCollection.Get<IServerAddressesFeature>();
if (serverFeatures .Addresses.Count == 0)
{
    ListenOn(DefaultAddress); // Start the server on the default address
    serverFeatures.Addresses.Add(DefaultAddress) // Add the default address to the IServerAddressesFeature
}

Note that for Kestrel and HttpSysServer, the priority for address resolution is

  1. Direct configuration via KestrelServerOptions.Listen() or HttpSysOptions.UrlPrefixes.Add()
  2. List of addresses in IServerAddressesFeature.Addresses
  3. Default address chosen by the server

@muratg
Copy link

muratg commented May 12, 2017

We are closing this issue because no further action is planned for this issue. If you still have any issues or questions, please log a new issue with any additional details that you have.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants