我的网站启用了 Windows 身份验证,并首先列出了协商提供程序,因为我想使用 Kerberos 进行委派。当我从Web服务器本身的浏览器运行网站时,它可以正常工作。当我从域中的另一台计算机使用 IE 时,我会收到登录框。尝试 3 次后,我收到 HTTP 401.2 错误:未经授权。
我已经确保应用程序池使用的域帐户对网站文件夹具有读取和执行权限,我在访问网站时登录的域帐户也是如此(并且我还投入了"经过身份验证的用户"以示好)。
有趣的是,如果我尝试使用 Web 服务器的 IP 而不是名称访问该站点,它会加载正常。
有人有想法吗?
在我第一次遇到这个问题一年后,我已经解决了它。
从 http://blogs.technet.com/b/proclarity/archive/2011/03/08/useapppoolcredentials-true-with-kerberos-delegation-on-2008.aspx 那里得到了提示
需要在 applicationHost.config 中的 windowsAuthentication 元素上设置 useAppPoolCredentials="true"(可以通过 IIS 管理器设置)
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" useKernelMode="true" useAppPoolCredentials="true">
<providers>
<clear />
<add value="Negotiate" />
</providers>
<extendedProtection tokenChecking="None" />
</windowsAuthentication>
</authentication>
</security>
</system.webServer>
使用 DNS 名称时收到 401.2 的原因很可能是因为在 AD 中注册了用作服务主体名称 (SPN) 的名称。
这里有几个链接应该可以帮助你:
使用 IIS 7.0/7.5 进行 Kerberos 身份验证的服务主体名称 (SPN) 清单http://blogs.msdn.com/b/webtopics/archive/2009/01/19/service-principal-name-spn-checklist-for-kerberos-authentication-with-iis-7-0.aspx
为 Kerberos 连接注册服务主体名称:http://technet.microsoft.com/en-us/library/ms191153.aspx