[英]IIS Express is automatically disabling anonymous authentication for my project, why?
When I switch my ASP.NET MVC project from Cassini web server to IIS Express, this is added to my applicationhost.config
file: 当我将我的ASP.NET MVC项目从Cassini Web服务器切换到IIS Express时,这将添加到我的applicationhost.config
文件中:
<location path="MyProject">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
It's causing the site not to load with 401.2 - Unauthorized and I can't fix it on the Web.config level - it will then complain that the section is locked at parent level (HTTP 500.19). 这导致该站点无法加载401.2-未经授权,并且我无法在Web.config级别上对其进行修复-然后它将抱怨该部分被锁定在父级别(HTTP 500.19)。
I can fix it by amending the applicationhost.config
file but I don't understand why I should need to when no such section is added for a vanilla ASP.NET MVC project. 我可以通过修改applicationhost.config
文件来修复它,但是当不为原始ASP.NET MVC项目添加此类部分时,我不明白为什么要这样做。 What can be wrong? 有什么事吗
I'm using VS 11 beta but also confirmed this weird behavior in 2010 SP1. 我正在使用VS 11 beta,但也确认了2010 SP1中的这种奇怪行为。 IIS Express says it's version 7.5. IIS Express表示它是7.5版。
It was because for some reason, this was in my csproj file: 因为某种原因,这在我的csproj文件中:
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
Setting it to enabled
fixes the issue (it can also be done from Visual Studio, select project, F4, set Anonymous Authentication in the properties grid to Enabled ). 将其设置为enabled
可解决该问题(也可以从Visual Studio中完成,选择项目,F4,然后在属性网格中将“ 匿名身份验证”设置为Enabled )。
请在按F4之前右键单击该项目并选择使用iis express。
Sometimes ago, I faced the same difficulty, but it was little different from what I see over here. 有时以前,我面临着同样的困难,但是与我在这里看到的并没有什么不同。 In my laptop I have both VS 08 and VS 13, and SQL Server 2008 R2 and 11G XE. 在我的笔记本电脑中,我同时拥有VS 08和VS 13,以及SQL Server 2008 R2和11G XE。 For websites connecting to R2 has never been a problem, but when I was trying to build a website using oracle membership with asp.net, I found that pages open but pages under folder with roles are not opening and giving me the access denied error. 对于连接到R2的网站来说从来没有问题,但是当我尝试使用具有asp.net的oracle成员身份建立网站时,我发现页面打开,但是具有角色的文件夹下的页面没有打开,并且给了我拒绝访问的错误。 Though the folder had a proper web.config inside and the user created with the same role, still it was throwing up the same error. 尽管该文件夹内部具有适当的web.config,并且用户创建的角色相同,但仍引发相同的错误。 Finally I realized I need the authentication mechanism going and so I added the following code in the system.web of web.config: 最后,我意识到我需要身份验证机制,因此我在web.config的system.web中添加了以下代码:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" protection="All" slidingExpiration="true"
timeout="90" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="false"/>
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
And it did work, now my authenticated users can loginto designated folders! 它确实起作用了,现在我经过身份验证的用户可以登录到指定的文件夹了! I hope this might help someone who faced issues similar to me. 我希望这可以帮助遇到类似我的问题的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.