Kestrel port binding default to 80 or 443 / No error/warn/info/debug when "{abc}" provided
See original GitHub issueHello 👋
Describe the bug
Invalid Http/Https
binding can be defaulted without any log and go on
After few long minutes (hours?) of debugging we found out that invalid port configuration will not say anything and silent.
Why did it takes so long ?
Because we were looking for the https binding that was https://*:8443
on our POD, and it seems that another appsettings...json
file still had an http://*:{place.holder} that was not replaced
So it seems that it defaulted to port 80 without saying anything at all.
The behavior was AccessDeniedException
on a Socket
binding attempt (because Pods should not run as root so any binding bellow 1024 is forbidden)
Questions
so I wonder about 3 things now :
- should the SocketException / AccessDenied be explicit on the full binding url that was denied ? => http://[::]:80 or http://*:80`
- should there be at least a WARNING on the fact that a string with letter and placerhoder is probably not a valid URI / Port ?
- is there any form of URI that would makes this valid: http://*:{foo.bar.kix} with the port 80 ?
To Reproduce
dotnet new webapi
dotnet publish
cd ./bin/Debug/net5.0/publish/
$env:ASPNETCORE_URLS="https://*:{abc}"
./foo.exe
Further technical details
- ASP.NET Core version : both 3.1.x and 5.0-preview6
- Include the output of
dotnet --info
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Breaking change: Kestrel: Default HTTPS binding removed
The default HTTPS address and port have been removed from Kestrel in .NET 7. This change is part of dotnet/aspnetcore#42016, which will improve ......
Read more >Configure endpoints for the ASP.NET Core Kestrel web ...
ASP.NET Core projects are configured to bind to a random HTTP port between 5000-5300 and a random HTTPS port between 7000-7300. This default...
Read more >Removing Kestrel binding warning - asp.net core
I have removed the default URL from launchSettings.json and there are no environment variables defined by me. Yet I still get this warning....
Read more >Untitled
NET Core Kestrel web server WebJul 28, 2020 · Kestrel port binding default to 80 or 443 / No error/warn/info/debug when " {abc}"...
Read more >Port binding in ASP.NET Core - Ehsan Mirsaeedi - Medium
When ASP.NET Core app is deployed to Development environment, by default, Kestrel listens for requests on port 5000 for http and port 5001 ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
At a minimum we should log a warning.
We’ve moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.