.NET5 Windows 身份验证提示

时间:2021-03-04 09:41:49

标签: iis .net-core windows-authentication

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

[Authorize(AuthenticationSchemes = IISDefaults.AuthenticationScheme)]

在我注册的服务中:

services.AddAuthentication(IISDefaults.AuthenticationScheme);

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

当我尝试访问受保护的端点时,在运行 IIS 10 的情况下将应用程序发布到 Windows Server(启用 HTTPS)后,我只会收到登录提示,无论我在其中输入什么,它都会消失我取消。

Windows IIS Server 中的 My Site 设置,Windows Auth 使用 Negotiate Provider: App authentification settings 应用程序池设置: Application pool in which app resides settings:

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

1 个答案:

答案 0 :(得分:0)

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

相关问题