Commit 4279611
Merged PR 21649: [internal/release/6.0] Make UseUrls() override default hosting config
## Description
Prior to this change, default config (typically loaded from `DOTNET_`/`ASPNET_` environment variables and command line arguments) could override the application-level configuration. This would prevent `GenericWebHostService` from seeing the latest configuration set by `UseUrls()` of `DOTNET_URLS`, `ASPNET_URLS` or `--urls` was set.
Fixes #38185
## Customer Impact
This is a big gotcha to customers using `WebApplicationBuilder` (which is used in all the ASP.NET Core 6 templates) who expect the following to work:
```C#
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://*:8080");
var app = builder.Build();
app.Run();
```
A comment on the issue suggesting we patch this has gotten 5 thumbs ups not counting mine.
## Regression?
- [ ] Yes
- [x] No
## Risk
- [ ] High
- [ ] Medium
- [x] Low
This is a small well tested change which only affects the loading of default config sources and those added via a `HostFactoryResolver` to host configuration. [Here’s the existing test](https://github.com/dotnet/aspnetcore/blob/0f6f649f1da658bbe37b8898df0c80c5affa9d2d/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs#L883) showing that the expected configuration providers are still dispose.
## Verification
- [x] Manual (required)
- [x] Automated
## Packaging changes reviewed?
- [ ] Yes
- [ ] No
- [x] N/A1 parent a9a609a commit 4279611
File tree
2 files changed
+44
-4
lines changed- src/DefaultBuilder
- src
- test/Microsoft.AspNetCore.Tests
2 files changed
+44
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| |||
194 | 197 | | |
195 | 198 | | |
196 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
197 | 203 | | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
| 210 | + | |
204 | 211 | | |
205 | 212 | | |
206 | | - | |
207 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
208 | 216 | | |
209 | 217 | | |
210 | | - | |
| 218 | + | |
211 | 219 | | |
212 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
213 | 226 | | |
214 | 227 | | |
215 | 228 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
132 | 159 | | |
133 | 160 | | |
134 | 161 | | |
| |||
0 commit comments