Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebApplicationBuilder.WebHost.UseUrls() does not do anything in ASP.NET Core 6 Preview 7 #36245

Closed
johnkors opened this issue Sep 7, 2021 · 2 comments

Comments

@johnkors
Copy link

johnkors commented Sep 7, 2021

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]
@johnkors
Copy link
Author

johnkors commented Sep 7, 2021

Seems to be fixed in RC1. Tested the nightlies from mcr.microsoft.com/dotnet/nightly/sdk:6.0, and that did not have the above issue.

.NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.1.21453.13
 Commit:    509eff6ece

Runtime Environment:
 OS Name:     debian
 OS Version:  11
 OS Platform: Linux
 RID:         debian.11-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100-rc.1.21453.13/

Host (useful for support):
  Version: 6.0.0-rc.1.21451.13
  Commit:  d7619cd4b1

.NET SDKs installed:
  6.0.100-rc.1.21453.13 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

@davidfowl
Copy link
Member

Great! We should be able to close this one then

@johnkors johnkors closed this as completed Sep 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants