asp.net-mvc HTTP 错误 401.2 - 工作应用程序池中的新站点未经授权
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16902601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTTP Error 401.2 - Unauthorized for new site in a working app pool
提问by Splendor
I am deploying a new EF 4.0 ASP.NET MVC 4 site to an IIS 7.0 server but I'm getting an error that says:
我正在将一个新的 EF 4.0 ASP.NET MVC 4 站点部署到 IIS 7.0 服务器,但我收到一条错误消息:
"HTTP Error 401.2 - Unauthorized You are not authorized to view this page due to invalid authentication headers."
“HTTP 错误 401.2 - 未经授权 由于身份验证标头无效,您无权查看此页面。”
I have Anonymous Authentication and Forms Authentication disabled. ASP.NET Impersonation and Windows Authentication are both enabled.
我禁用了匿名身份验证和表单身份验证。ASP.NET 模拟和 Windows 身份验证均已启用。
I've confirmed that everything okay according to this Microsoft KB article
我已经根据这篇 Microsoft KB文章确认一切正常
Even better, there is already a working site in the same app pool using the same type of authentication.
更好的是,在同一个应用程序池中已经有一个使用相同类型身份验证的工作站点。
I'm not sure what to check next. Does anyone have an idea what's causing this error?
我不确定接下来要检查什么。有谁知道是什么导致了这个错误?
回答by Splendor
I figured it out. I had to add this to my applicationHost.config file (located in the windows/system32/inetsrv/config folder).
我想到了。我必须将此添加到我的 applicationHost.config 文件(位于 windows/system32/inetsrv/config 文件夹中)。
<windowsAuthentication enabled="true">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
It was there for the other working application but not this new one.
它用于另一个工作应用程序,但不是这个新应用程序。
回答by Nathan
On a recently built 2012R2 web server I kept running in to this error even for simple cases. I finally fixed it by reinstalling the Windows Authentication feature.
在最近构建的 2012R2 Web 服务器上,即使是简单的情况,我也一直遇到此错误。我终于通过重新安装 Windows 身份验证功能修复了它。
PowerShell:
电源外壳:
Remove-WindowsFeature Web-Windows-Auth
Add-WindowsFeature Web-Windows-Auth

