This issue is for discussion and questions related to aspnet/Announcements#181
We have removed support in Kestrel for server URLs which contain only a port number. This was done to avoid confusion about whether Kestrel would bind to http://locahost:port or http://+:port.
In RC2, the following code causes Kestrel to bind to http://+:12345:
``` C#
var host = new WebHostBuilder()
.UseUrls("12345")
.UseKestrel()
In future releases, the code must be changed to explicitly bind to either `localhost` or `+`:
``` C#
var host = new WebHostBuilder()
.UseUrls("http://localhost:12345")
.UseKestrel()
c#
var host = new WebHostBuilder()
.UseUrls("http://+:12345")
.UseKestrel()
@mikeharder Think it might be worth locking https://github.com/aspnet/Announcements/issues/181? 馃槃
@khellang: Thanks for the reminder.
If I recall correctly, the syntax before was http://*:12345. What's the reasoning for changing it to +?
The host doesn't actually matter in kestrel. Only localhost has a defined meaning. Anything else binds to 0.0.0.0.
Other consumers of the URL might treat http://+ and http://* differently. For example, see strong wildcard and weak wildcard in the documentation for http.sys: https://msdn.microsoft.com/en-us/library/aa364698%28v=VS.85%29.aspx
We didn't actually change kestrel to evaluate + and * though right? Just using + in the examples to avoid a potential issue if you switch your app to a http.sys based server?
@glennc: Correct. We can switch to using http://* in examples if it causes less confusion.
I'd like to add a vote for http://*
@mikeharder
In RC2 and from older self-host owin guidance I found on Azure it seems the following makes Kestrel listen to all IP address assigned to a machine:
.UseUrls("http://+:12345")
Is this feature still supported in post RC2 (aka RTM) Kestrel builds? We have an issue where we need Kestrel to listen to all IP addresses assigned to an Azure VM without hard coding these values.
Thanks.
Yes, that's still supported. The specific wildcard character you use does not really matter yet, kestrel only special cases IP Addresses and localhost. Anything else will cause it to listen on all IPs.
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.
Most helpful comment
Yes, that's still supported. The specific wildcard character you use does not really matter yet, kestrel only special cases IP Addresses and
localhost. Anything else will cause it to listen on all IPs.