-
Notifications
You must be signed in to change notification settings - Fork 523
Kestrel config binder should understand * and localhost #1879
Comments
From @Tratcher on April 27, 2017 17:14 |
@muratg @DamianEdwards @Eilon We chatted about this one and we think we need to get this into preview1. @muratg please assign. |
We chatted even more and the fix is more complicated than we want to take right now. We'll have to tell folks to browse to localhost. |
@glennc This issue is also the first in a series of issue that prevents enabling docker for out templates that use authentication. |
I'm also seeing a port forwarding issue with the "dotnet new web" template and the current docker image "microsoft/dotnet" I also see the warning with "Unable to bind to http://localhost:5000 on the IPv6 loopback interface: (Error -99 EADDRNOTAVAIL address not available)". root@24cf43adf652:~# dotnet new web -o www
Content generation time: 74.6508 ms
The template "ASP.NET Core Empty" created successfully.
root@24cf43adf652:~# cd www/
root@24cf43adf652:~/www# dotnet restore
Restoring packages for /root/www/www.csproj...
Generating MSBuild file /root/www/obj/www.csproj.nuget.g.props.
Generating MSBuild file /root/www/obj/www.csproj.nuget.g.targets.
Writing lock file to disk. Path: /root/www/obj/project.assets.json
Restore completed in 680.72 ms for /root/www/www.csproj.
NuGet Config files used:
/root/.nuget/NuGet/NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
root@24cf43adf652:~/www# dotnet run
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: (Error -99 EADDRNOTAVAIL address not available)
Hosting environment: Production
Content root path: /root/www
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down. My current solution is amending the Program.cs file to include public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseUrls("http://*:5000")
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
} |
@pflannery try using the |
@natemcmaster Thanks. I just tried that and get blocked when running root@29095298643c:~# dotnet --info
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 Following that link didnt seem to solve my issue so I tried to run through the linux debian sdk commands here https://www.microsoft.com/net/core#linuxdebian but still same problem. Following https://www.microsoft.com/net/core#dockercmd gets me as far as the EADDRNOTAVAIL error I reported above. |
@pflannery If you need to build an app in the container, use |
This issue was moved to aspnet/AspNetCoreModule#136 |
I think this was closed in error, the EADDRNOTAVAIL issue was unrelated to the original configuration issue. |
From @Tratcher on April 27, 2017 17:0
The templates are going to enable SSL via config in dev and production. They need to set up the rest of the endpoints when they do this. aspnet/MetaPackages#44 added the ability to bind to IPs and ports, but that makes for a poor user experience. In dev the templates want localhost, but will have to specify 127.0.0.1 (and ::1) if they want IPv6 support. In production they'll need to specify a public IP (0.0.0.0 and ::0).
Config should allow
localhost
that binds to 127.0.0.1 and ::1, and * that binds to 0.0.0.0 and ::0, using the same logic that kestrel applies to UseUrls values. Even better, implement this in Kestrel with a Listen that takes the string ip/host so you don't have to duplicate all of the logic.Copied from original issue: aspnet/MetaPackages#73
The text was updated successfully, but these errors were encountered: