Asp.Net core bug? Blazor/Http.Sys with Windows Authentication shows “The connection was reset”?

半世苍凉 提交于 2019-12-22 00:26:43

问题


Update: Just tried the official example https://github.com/aspnet/AspNetCore.Docs/tree/master/aspnetcore/fundamentals/servers/httpsys/samples/3.x/SampleApp and it doesn't work.

Brower message:

This site can’t provide a secure connection
localhost sent an invalid response.

Output:

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\xxx\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
warn: Microsoft.AspNetCore.Server.HttpSys.MessagePump[0]
      Overriding address(es) 'https://localhost:5001, http://localhost:5000'. Binding to endpoints added to UrlPrefixes instead.
info: Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[0]
      Start
info: Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[0]
      Listening on prefix: http://localhost:5005/
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5005/
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\xxx\Downloads\AspNetCore.Docs-master\AspNetCore.Docs-master\aspnetcore\fundamentals\servers\httpsys\samples\3.x\SampleApp

I created a new Blazor application with Windows Authentication. (Visual Studio 2019 V16.4.0, .Net Core 3.1).

Now Windows Authentication works (the top right corner of the web page shows "Hello Domain\Username!") when running with IIS Express in Visual Studio. But Windows Authentication is not working when running as Kestrel application.

I followed the steps in the following link to make Windows Authentication work with Http.Sys. (BTW, I tried [Kestrel/Negotiate][1] but no luck)

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/httpsys?view=aspnetcore-3.1

Basically, it just adds the call of webBuilder.UseHttpSys() in CreateHostBuilder() in Program.cs.

    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("http://*:5005");
                });
                webBuilder.UseStartup<Startup>();
            });

However, running the application will get an error page with message of

This site can’t be reached
The connection was reset.

or

This site can’t provide a secure connection
localhost sent an invalid response.

Edge's error messages are:

There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND

IE error message:

Can’t connect securely to this page

This might be because the site uses outdated or unsafe TLS security settings. If this keeps happening, try contacting the website’s owner.

来源:https://stackoverflow.com/questions/59218273/asp-net-core-bug-blazor-http-sys-with-windows-authentication-shows-the-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!