diff --git a/test/ServerComparison.TestSites.Standalone/Program.cs b/test/ServerComparison.TestSites.Standalone/Program.cs index 02bbdd700c..0500b08856 100644 --- a/test/ServerComparison.TestSites.Standalone/Program.cs +++ b/test/ServerComparison.TestSites.Standalone/Program.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Net.Http.Server; @@ -13,7 +14,6 @@ namespace ServerComparison.TestSites.Standalone { var config = new ConfigurationBuilder() .AddCommandLine(args) - .AddEnvironmentVariables(prefix: "ASPNETCORE_") .Build(); var builder = new WebHostBuilder() @@ -24,7 +24,9 @@ namespace ServerComparison.TestSites.Standalone // Switch beteween Kestrel and WebListener for different tests. Default to Kestrel for normal app execution. if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)) { - if (string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal)) + if (string.Equals(builder.GetSetting("environment") ?? + Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), + "NtlmAuthentication", System.StringComparison.Ordinal)) { // Set up NTLM authentication for WebListener as follows. // For IIS and IISExpress use inetmgr to setup NTLM authentication on the application or diff --git a/test/ServerComparison.TestSites/Program.cs b/test/ServerComparison.TestSites/Program.cs index e6d0dba35d..f272541cb8 100644 --- a/test/ServerComparison.TestSites/Program.cs +++ b/test/ServerComparison.TestSites/Program.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Net.Http.Server; +using System; namespace ServerComparison.TestSites { @@ -13,9 +14,8 @@ namespace ServerComparison.TestSites { var config = new ConfigurationBuilder() .AddCommandLine(args) - .AddEnvironmentVariables(prefix: "ASPNETCORE_") .Build(); - + var builder = new WebHostBuilder() .UseConfiguration(config) .UseIISIntegration() @@ -24,7 +24,9 @@ namespace ServerComparison.TestSites // Switch beteween Kestrel and WebListener for different tests. Default to Kestrel for normal app execution. if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)) { - if (string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal)) + if (string.Equals(builder.GetSetting("environment") ?? + Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), + "NtlmAuthentication", System.StringComparison.Ordinal)) { // Set up NTLM authentication for WebListener as follows. // For IIS and IISExpress use inetmgr to setup NTLM authentication on the application or