使Kestrel使用Windows身份验证

问题描述 投票:0回答:1

我尝试通过以下链接使Kestrel进行Window身份验证:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/httpsys?view=aspnetcore-3.0#how-to-use-httpsyshttps://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.0&tabs=visual-studio#httpsys

这里是代码。

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseHttpSys(options =>
                {
                    options.AllowSynchronousIO = true;
                    options.Authentication.Schemes = AuthenticationSchemes.None;
                    options.Authentication.AllowAnonymous = true;
                    options.MaxConnections = null;
                    options.MaxRequestBodySize = 30000000;
                    options.UrlPrefixes.Add("https://localhost:8080");
                });
                webBuilder.UseStartup<Startup>()
                    .UseHttpSys(options =>
                    {
                        options.Authentication.Schemes =
                            AuthenticationSchemes.NTLM |
                            AuthenticationSchemes.Negotiate;
                        options.Authentication.AllowAnonymous = false;
                    });
            });

但是,浏览器https://localhost:8080显示以下错误消息(边缘)?

无法安全连接到此页面这可能是因为该站点使用了过时或不安全的TLS安全设置。如果这种情况持续发生,请尝试与网站所有者联系。

c# asp.net-core windows-authentication blazor httpsys
1个回答
0
投票

这是因为您的计算机上未安装开发认证。试试这个:

dotnet dev-certs https --trust
© www.soinside.com 2019 - 2024. All rights reserved.