Windows 身份验证在本地主机上有效,但在 IIS 上的其他站点上无效

Windows Authentication working on localhost but not on other site on IIS

我正在尝试在使用 Windows 身份验证的本地 IIS 上设置一个仅 html/css/js 的简单站点。

到目前为止我只有一个 c://mysite/index.html 文件

当我指向默认的 IIS 网站(即 http://localhost) to this folder and enable Windows Authentication, I am shown the login dialog when I browse to it. When I enter my creds it then shows the index.html fine. But when I setup a new IIS site (e.g http://local.mysite I have a host entry for this) pointing to the same folder, with Windows Authentication enabled, I cannot get passed the login dialog. It just redisplays as if the login creds were wrong, but I'm entering the same creds as I did in http://localhost

我已将 http://local.mysite 添加到 Internet 选项中的本地 Intranet 区域,但这并不能解决问题。 我也设置了 local.mysite 的应用程序池与 localhost

相同

关于为什么这不起作用的任何想法?

终于找到答案了。
问题是 Windows 中的环回检查安全功能。

可以在此处找到此问题的修复程序 https://support2.microsoft.com/default.aspx?scid=kb;en-us;896861support2.microsoft.com/default.aspx?scid=kb;en-us;896861

不幸的是,最初接受的答案引用了一篇不再存在的文章。

本文包含针对此问题的 step-by-step 修复 - 它甚至可能是新位置的最初引用的文章。

https://social.technet.microsoft.com/wiki/contents/articles/37337.disable-loopback-check-in-iis.aspx

综上所述,您需要将注册表项 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LsaDisableLoopbackCheck 设置为 DWORD1

在 Powershell 中检查您的当前值:

Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" -Name DisableLoopbackCheck

这应该return

1