asp.net-mvc 所有请求都收到 HTTP 错误 401.2 - 未经授权的响应
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11687711/
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
All requests getting HTTP Error 401.2 - Unauthorized response
提问by LDJ
My MVC app has, until a few minutes ago, been working fine (with asp/net membership as part of the solution). However, without knowingly changing anything relevant every request, even to my homecontroller (which doesn't have any authorization attributes etc).
直到几分钟前,我的 MVC 应用程序一直运行良好(将 asp/net 成员资格作为解决方案的一部分)。但是,即使是我的家庭控制器(没有任何授权属性等),也不会有意更改每个请求相关的任何内容。
I've taken all the entries out of the web.config for now relating to authorization, and I've check the applicationhost.config which has the following:
我已经从 web.config 中取出了所有与授权相关的条目,并且我已经检查了具有以下内容的 applicationhost.config:
<access sslFlags="None" />
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
<authentication>
<anonymousAuthentication enabled="true" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="false">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
<authorization>
<add accessType="Allow" users="*" />
</authorization>
Can anyone suggest what may be causing this?
任何人都可以提出可能导致这种情况的原因吗?
Thanks
谢谢
Further information on this, I switched to using full IIS and its working fine now, so it looks like its an IIS Express issue. Any clues as to the cause? Is there no full IIS express gui other than the system tray icon?
关于这方面的更多信息,我改用了完整的 IIS,现在它工作正常,所以它看起来像是 IIS Express 问题。关于原因的任何线索?除了系统托盘图标之外,是否没有完整的 IIS express gui?
回答by vikomall
Option-1:
选项1:
In applicationhost.config check if there is any entry as shown below. If there is any such entry change anonymousAuthetication enabled value from 'false' to 'true'.
在 applicationhost.config 中检查是否有如下所示的条目。如果有任何此类条目,则将启用匿名验证的值从“假”更改为“真”。
<location path="YOUR-APPLICATION-NAME">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
Option-2:
选项 2:
If you are using visual studio, make sure that anonymousAuthentication is enabled.

如果您使用的是visual studio,请确保启用了anonymousAuthentication。

回答by Dan B
This defeats the purpose -- if you enable anonymous auth, you are no longer using Active Directory... here is a better answer ....
这违背了目的——如果您启用匿名身份验证,您将不再使用 Active Directory……这是一个更好的答案……
HTTP Error 401.2 - Unauthorized for new site in a working app pool

