Closed
Description
Describe the bug
WebApplicationBuilder.WebHost.UseUrls()
won't let me override the default port.
To Reproduce
Setup a standard "Minimal APIs" Program.cs configuration, and try to set the host urls using the WebApplicationBuilder.WebHost.UseUrls(..)
API.
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://*:8080");
var app = builder.Build();
app.Run();
Output:
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
As a workaround, I found that the app.Run(urls)
method do work however:
- builder.WebHost.UseUrls("http://*:8080");
+ app.Run("http://*:8080");
Repro repo: davidfowl/TodoApp#4
Further technical details
TodoApi git:(main) docker run mcr.microsoft.com/dotnet/sdk:6.0 dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.7.21379.14
Commit: 22d70b47bc
Runtime Environment:
OS Name: debian
OS Version: 11
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/6.0.100-preview.7.21379.14/
Host (useful for support):
Version: 6.0.0-preview.7.21377.19
Commit: 91ba01788d
.NET SDKs installed:
6.0.100-preview.7.21379.14 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Metadata
Metadata
Assignees
Labels
No labels