diff --git a/src/MusicStore.Standalone/Program.cs b/src/MusicStore.Standalone/Program.cs index eaeec66b87..025741cf7d 100644 --- a/src/MusicStore.Standalone/Program.cs +++ b/src/MusicStore.Standalone/Program.cs @@ -22,9 +22,11 @@ namespace MusicStore.Standalone .UseIISIntegration() .UseStartup("MusicStore.Standalone"); - if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal) - && string.Equals(builder.GetSetting("environment") ?? - Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), "NtlmAuthentication", System.StringComparison.Ordinal)) + if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal) && + (string.Equals(builder.GetSetting("environment") ?? + Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), + "NtlmAuthentication", + System.StringComparison.Ordinal))) { // Set up NTLM authentication for WebListener like below. // For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or diff --git a/src/MusicStore/Program.cs b/src/MusicStore/Program.cs index 00581eb8ba..d6b4bfa072 100644 --- a/src/MusicStore/Program.cs +++ b/src/MusicStore/Program.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Net.Http.Server; @@ -18,12 +19,16 @@ namespace MusicStore .UseIISIntegration() .UseStartup("MusicStore"); - // 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") ?? + if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal) && + (string.Equals(builder.GetSetting("environment") ?? Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), - "NtlmAuthentication", System.StringComparison.Ordinal)) + "NtlmAuthentication", + System.StringComparison.Ordinal))) + { + // Set up NTLM authentication for WebListener like below. + // For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or + // modify the applicationHost.config to enable NTLM. + builder.UseWebListener(options => { // Set up NTLM authentication for WebListener as follows. // For IIS and IISExpress use inetmgr to setup NTLM authentication on the application or