From e72c9e3e469fefdf133112a59424084e59ac9929 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Thu, 14 Apr 2016 17:27:54 -0700 Subject: [PATCH 1/2] Fix typo in URL --- src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml b/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml index a562dad..abfa56e 100644 --- a/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml +++ b/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml @@ -3,7 +3,7 @@ - From 8e4580f95631b23c6f7499e894b26979e2b1e601 Mon Sep 17 00:00:00 2001 From: Chris R Date: Sat, 16 Apr 2016 23:27:55 -0700 Subject: [PATCH 2/2] React to WebListener configuration changes. --- src/MusicStore/Program.cs | 20 +++++++++++++++++--- src/MusicStore/StartupNtlmAuthentication.cs | 10 ---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/MusicStore/Program.cs b/src/MusicStore/Program.cs index 3aa4520..cc49ac2 100644 --- a/src/MusicStore/Program.cs +++ b/src/MusicStore/Program.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Hosting; +using Microsoft.Net.Http.Server; namespace MusicStore { @@ -6,14 +7,27 @@ namespace MusicStore { public static void Main(string[] args) { - var host = new WebHostBuilder() + var builder = new WebHostBuilder() // We set the server by name before default args so that command line arguments can override it. // This is used to allow deployers to choose the server for testing. .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseDefaultHostingConfiguration(args) .UseIISIntegration() - .UseStartup("MusicStore") - .Build(); + .UseStartup("MusicStore"); + + if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal) + && string.Equals(builder.GetSetting("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 + // modify the applicationHost.config to enable NTLM. + builder.UseWebListener(options => + { + options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM; + }); + } + + var host = builder.Build(); host.Run(); } diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index a3c61a4..040b1b6 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -102,16 +102,6 @@ namespace MusicStore // request pipeline. // Note: Not recommended for production. app.UseDeveloperExceptionPage(); - - // 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. - var listener = app.ServerFeatures.Get(); - if (listener != null) - { - listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM; - } - app.UseDatabaseErrorPage(); // Add the runtime information page that can be used by developers