IIS and Windows authentication is not applicable when you host your service with the console app. I am using the below code enable HTTPS for my identity server
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel(options =>
{
options.Listen(IPAddress.Any,44333, listenOptions =>
{
listenOptions.UseHttps("Path to SSL certificate","SSL Cert Password");
}
});
})
.UseStartup<Startup>()
.Build();
I see you are using .NET Core.
.NET Core is hosted in Kestrel instead of the normal IIS and does not support windows authentication. Although you can use HTTP.sys which is a web server implementation in .NET Core and does support windows authentication.
The below code configures the app's web host to use HTTP.sys with Windows authentication.
public class Program
{
public static void Main(string[] args) =>
BuildWebHost(args).Run();
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseHttpSys(options =>
{
options.Authentication.Schemes =
AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
options.Authentication.AllowAnonymous = false;
})
.Build();
}
the article explaining this code is here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.