【问题标题】:Authorize a directory for anonymous users IIS 7.5?为匿名用户 IIS 7.5 授权目录?
【发布时间】:2011-02-04 18:29:39
【问题描述】:

我正在尝试在 IIS 7.5 中添加一个用于匿名访问的目录。它适用于 Web Dev 但不适用于 IIS 7.5

我目前在目录中使用这个 web.config。这是一个带有样式表的目录:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->

    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>
            <authorization>

                <allow users="*" />

            </authorization>

        </system.web>
    </configuration>

更新:

我已进入文件夹并在身份验证下,我已将匿名身份验证从 IIS_USR 更改为池。这似乎是正确的。

我将奖励任何提供非常好的解释和资源以理解此设置的人。此外,如何在全球范围内应用它会很高兴——适用于所有文件夹。

【问题讨论】:

    标签: asp.net iis-7


    【解决方案1】:

    既然您回答了自己的问题,这里的解释可能会有所帮助

    授权涉及 IIS 将向谁提供资源。但是,这些资源具有自己的安全性,因为它们只是文件系统上的文件。

    配置中的 Authentication 元素有助于确定 IIS 在接受用户请求后如何识别用户请求,以及在访问 IIS 之外/外部的资源时如何识别。

    这是在站点级别设置的,通常在您服务器的 applicationHost.config 文件中。如果设置正确,它可以在站点级别被覆盖。

    有关此的 IIS.net 页面:

    http://www.iis.net/ConfigReference/system.webServer/security/authorization/add

    http://www.iis.net/ConfigReference/system.webServer/security/authentication/anonymousAuthentication

    您在 UI 中所做的 .config 版本是:

    <location path="/yourSite">
       <system.webServer>
          <security>
             <authentication>
                <anonymousAuthentication enabled="true" username="" />
              </authentication>
          </security>
       </system.webServer>
    </location>
    

    马上。 auth 方法,用户名字段是访问资源时 IIS 将模拟的人。不指定时,默认使用apppool的标识。

    现在,至于为什么这很重要...检查磁盘上的实际文件(.css)。如果这解决了问题,则意味着 IUSR 无权读取该文件。

    【讨论】:

      【解决方案2】:

      您没有为您的授权定义一个位置。您也没有指定您在 web.config(如果有)中使用的身份验证类型。

      <location path="/">
          <system.web>
          <authorization>
              <allow users="*"/>
              </authorization>
          </system.web>
      </location>
      

      【讨论】:

        猜你喜欢
        • 2011-11-11
        • 2011-06-21
        • 2016-10-22
        • 1970-01-01
        • 2016-10-10
        • 1970-01-01
        • 2012-06-09
        • 1970-01-01
        • 2012-12-20
        相关资源
        最近更新 更多