Skip to content

Commit 0eeb6b2

Browse files
authored
[release/8.0][wasm] Use intended ports when running DevServer (#92906)
* [wasm] Ignore empty `$ASPNETCORE_URLS` * [wasm] DevServer: honor urls specified in the options * [wasm] CI: Don't trigger non-wbt jobs on wasm-app-host changes * CI: don't trigger wasm runtime tests on wasm-app-host changes * [wasm] wasmbrowser - change the default webserver port to 0, to randomly select a port
1 parent a7c9419 commit 0eeb6b2

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

eng/pipelines/common/evaluate-default-paths.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ jobs:
241241
- src/mono/tools/*
242242
- src/mono/wasi/*
243243
- src/mono/wasm/debugger/*
244+
- src/mono/wasm/host/*
244245
- src/mono/wasm/Wasm.Build.Tests/*
245246
- ${{ parameters._const_paths._wasm_pipelines }}
246247
- ${{ parameters._const_paths._always_exclude }}
@@ -258,6 +259,7 @@ jobs:
258259
- eng/testing/workloads-testing.targets
259260
- src/mono/mono/component/mini-wasm-debugger.c
260261
- src/mono/wasm/debugger/*
262+
- src/mono/wasm/host/*
261263
- src/mono/wasm/Wasm.Build.Tests/*
262264
- src/mono/nuget/Microsoft.NET.Runtime*
263265
src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/*

src/mono/wasm/host/BrowserHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private async Task RunAsync(ILoggerFactory loggerFactory, CancellationToken toke
7474
debugging: _args.CommonConfig.Debugging);
7575
runArgsJson.Save(Path.Combine(_args.CommonConfig.AppPath, "runArgs.json"));
7676

77-
string[] urls = envVars.TryGetValue("ASPNETCORE_URLS", out string? aspnetUrls)
77+
string[] urls = (envVars.TryGetValue("ASPNETCORE_URLS", out string? aspnetUrls) && aspnetUrls.Length > 0)
7878
? aspnetUrls.Split(';', StringSplitOptions.RemoveEmptyEntries)
7979
: new string[] { $"http://127.0.0.1:{_args.CommonConfig.HostProperties.WebServerPort}", "https://127.0.0.1:0" };
8080

src/mono/wasm/host/DevServer/DevServer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ internal static class DevServer
4646
services.AddSingleton(Options.Create(options));
4747
services.AddSingleton(realUrlsAvailableTcs);
4848
services.AddRouting();
49-
});
49+
})
50+
.UseUrls(options.Urls);
5051

5152

5253
IWebHost? host = builder.Build();

src/mono/wasm/host/RuntimeConfigJson.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal sealed record WasmHostProperties(
2424
int? FirefoxDebuggingPort,
2525
int? ChromeProxyPort,
2626
int? ChromeDebuggingPort,
27-
int WebServerPort = 9000)
27+
int WebServerPort = 0)
2828
{
2929
// using an explicit property because the deserializer doesn't like
3030
// extension data in the record constructor

0 commit comments

Comments
 (0)