直到几分钟前,我的 MVC 应用程序一直运行良好(使用 asp/net 成员资格作为解决方案的一部分)。但是,在不故意更改每个请求相关的任何内容的情况下,甚至是我的家庭 Controller (没有任何授权属性等)。
我现在已经从 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>
任何人都可以提出可能导致此问题的原因吗?
谢谢
有关此问题的更多信息,我改用完整的 IIS,现在它工作正常,因此看起来像是 IIS Express 问题。有关原因的任何线索吗?除了系统托盘图标之外,是否没有完整的 IIS Express gui?
最佳答案
选项 1:
在 applicationhost.config 中检查是否有如下所示的条目。如果存在任何此类条目,请将启用匿名身份验证的值从“false”更改为“true”。
<location path="YOUR-APPLICATION-NAME">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
选项2:
如果您使用的是 Visual Studio,请确保启用匿名身份验证。
关于asp.net-mvc - 所有请求均出现 HTTP 错误 401.2 - 未经授权的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11687711/