简体   繁体   English

使 Http.sys 使用 Windows 身份验证

[英]Make Http.sys work with Windows Authentication

I try to make Window authentication work with Kestrel by following the links:我尝试通过以下链接使 Window 身份验证与 Kestrel 一起工作:

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

Here is the code.这是代码。

    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;
                    });
            });

However, browse https://localhost:8080 shows the following error message (Edge)?但是,浏览https://localhost:8080显示如下错误信息(Edge)?

Can't connect securely to this page This might be because the site uses outdated or unsafe TLS security settings.无法安全连接到此页面 这可能是因为该站点使用了过时或不安全的 TLS 安全设置。 If this keeps happening, try contacting the website's owner.如果这种情况持续发生,请尝试联系该网站的所有者。

It's because you didn't have development certification installed on your machine.这是因为你的机器上没有安装开发认证。 try this:试试这个:

dotnet dev-certs https --trust

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM