Skip to content

Commit 66029f3

Browse files
committed
Support passed URLs
1 parent f374f4c commit 66029f3

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/BenchmarksApps/TechEmpower/Kestrel/Program.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
using Microsoft.Extensions.Options;
77

88
var loggerFactory = new NullLoggerFactory();
9+
var configuration = new ConfigurationBuilder()
10+
.AddEnvironmentVariables("ASPNETCORE_")
11+
.AddCommandLine(args)
12+
.Build();
13+
914
var socketOptions = new SocketTransportOptions()
1015
{
1116
WaitForDataBeforeAllocatingBuffer = false,
1217
UnsafePreferInlineScheduling = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
1318
&& Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS") == "1"
1419
};
15-
if (int.TryParse(Environment.GetEnvironmentVariable("threadCount"), out var value))
20+
if (int.TryParse(configuration["threadCount"], out var value))
1621
{
1722
socketOptions.IOQueueCount = value;
1823
}
@@ -22,9 +27,18 @@
2227
loggerFactory
2328
);
2429

30+
var addresses = server.Features.GetRequiredFeature<IServerAddressesFeature>().Addresses;
31+
var urls = configuration["urls"];
32+
if (!string.IsNullOrEmpty(urls))
33+
{
34+
foreach (var url in urls.Split(';', StringSplitOptions.RemoveEmptyEntries))
35+
{
36+
addresses.Add(url);
37+
}
38+
}
39+
2540
await server.StartAsync(new BenchmarkApp(), CancellationToken.None);
2641

27-
var addresses = server.Features.GetRequiredFeature<IServerAddressesFeature>().Addresses;
2842
foreach (var address in addresses)
2943
{
3044
Console.WriteLine($"Now listening on: {address}");

src/BenchmarksApps/TechEmpower/Kestrel/Properties/launchSettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"commandName": "Project",
66
"dotnetRunMessages": true,
77
"launchBrowser": false,
8+
"applicationUrl": "http://localhost:5123",
89
"environmentVariables": {
910
"ASPNETCORE_ENVIRONMENT": "Development"
1011
}

0 commit comments

Comments
 (0)