Clean up server configuration.
This commit is contained in:
parent
909be6d307
commit
0668e45413
|
|
@ -8,23 +8,31 @@ namespace MusicStore
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var builder = 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)
|
.UseDefaultHostingConfiguration(args)
|
||||||
.UseIISIntegration()
|
.UseIISIntegration()
|
||||||
.UseStartup("MusicStore");
|
.UseStartup("MusicStore");
|
||||||
|
|
||||||
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)
|
// Switch beteween Kestrel and WebListener for different tests. Default to Kestrel for normal app execution.
|
||||||
&& string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Set up NTLM authentication for WebListener like below.
|
if (string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
||||||
// 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;
|
// Set up NTLM authentication for WebListener as follows.
|
||||||
});
|
// For IIS and IISExpress use inetmgr to setup NTLM authentication on the application or
|
||||||
|
// modify the applicationHost.config to enable NTLM.
|
||||||
|
builder.UseWebListener(options =>
|
||||||
|
{
|
||||||
|
options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.UseWebListener();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.UseKestrel();
|
||||||
}
|
}
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue