【问题标题】:.NET5 Windows Authentification Prompt.NET 5 Windows 身份验证提示
【发布时间】:2021-03-04 09:41:49
【问题描述】:

所以我开发了一个带有 Windows 身份验证的 API。当我使用 Visual 的 Studio IIS Express 运行项目时 - 端点受以下保护:

[Authorize(AuthenticationSchemes = IISDefaults.AuthenticationScheme)]

在我注册的服务中:

services.AddAuthentication(IISDefaults.AuthenticationScheme);

获取当前的 Windows 用户,我可以通过 HttpContextAccessor 访问。

在我将应用程序发布到 Windows Server(启用 HTTPS)并运行 IIS 10 后,当我尝试访问受保护的端点时,我只会收到登录提示,我输入的内容并不重要,只有在以下情况下才会消失我取消了。

Windows IIS Server 中的 My Site 设置,Windows Auth 使用 Negotiate Provider: 应用程序池设置:

我能做些什么来解决这个问题吗?如果这篇文章缺少一些其他信息,请告诉我,我会编辑它。

【问题讨论】:

    标签: iis .net-core windows-authentication


    【解决方案1】:

    当你同时开启匿名认证和认证时,iis会使用匿名认证,所以你需要关闭匿名认证再试一次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-20
      • 2023-03-22
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多