Browse Source

Fixing command line parameters for aspnetcore (#3591)

* Fixing command line parameters

* Reading command lines after environment variables
Sébastien Ros 7 years ago
parent
commit
4f2d770217

+ 2 - 2
frameworks/CSharp/aspnetcore/Benchmarks/Program.cs

@@ -30,9 +30,9 @@ namespace Benchmarks
             Console.WriteLine($"WebHostBuilder loading from: {typeof(WebHostBuilder).GetTypeInfo().Assembly.Location}");
             Console.WriteLine($"WebHostBuilder loading from: {typeof(WebHostBuilder).GetTypeInfo().Assembly.Location}");
 
 
             var config = new ConfigurationBuilder()
             var config = new ConfigurationBuilder()
-                .AddCommandLine(args)
-                .AddEnvironmentVariables(prefix: "ASPNETCORE_")
                 .AddJsonFile("hosting.json", optional: true)
                 .AddJsonFile("hosting.json", optional: true)
+                .AddEnvironmentVariables(prefix: "ASPNETCORE_")
+                .AddCommandLine(args)
                 .Build();
                 .Build();
 
 
             Server = config["server"] ?? "Kestrel";
             Server = config["server"] ?? "Kestrel";

+ 3 - 2
frameworks/CSharp/aspnetcore/Benchmarks/Startup.cs

@@ -25,10 +25,11 @@ namespace Benchmarks
             // Set up configuration sources.
             // Set up configuration sources.
             var builder = new ConfigurationBuilder()
             var builder = new ConfigurationBuilder()
                 .SetBasePath(hostingEnv.ContentRootPath)
                 .SetBasePath(hostingEnv.ContentRootPath)
-                .AddCommandLine(Program.Args)
                 .AddJsonFile("appsettings.json")
                 .AddJsonFile("appsettings.json")
                 .AddJsonFile($"appsettings.{hostingEnv.EnvironmentName}.json", optional: true)
                 .AddJsonFile($"appsettings.{hostingEnv.EnvironmentName}.json", optional: true)
-                .AddEnvironmentVariables();
+                .AddEnvironmentVariables()
+                .AddCommandLine(Program.Args)
+                ;
 
 
             Configuration = builder.Build();
             Configuration = builder.Build();
 
 

+ 1 - 1
frameworks/CSharp/aspnetcore/run-linux.sh

@@ -11,4 +11,4 @@ cp appsettings.postgresql.json appsettings.json
 dotnet restore
 dotnet restore
 dotnet publish --configuration Release --output bin/Release/publish
 dotnet publish --configuration Release --output bin/Release/publish
 
 
-dotnet bin/Release/publish/Benchmarks.dll server.urls=http://*:8080 scenarios=$1 server=kestrel threadCount=$threadCount NonInteractive=true
+dotnet bin/Release/publish/Benchmarks.dll urls=http://*:8080 scenarios=$1 server=kestrel threadCount=$threadCount NonInteractive=true