0

我最近创建了一个利用 Windows 身份验证的 MVC 应用程序。我有一个名为“EventReceivers”的子目录,希望允许匿名访问。我已经使用正确的位置元素更新了我的 web.config,并且在带有 IIS8 的 Windows Server 2012 上一切正常。但是,当我将同一个项目部署到 Azure 包时,EventReceivers 目录中的文件会提示用户输入凭据。下面是我的 web.config 片段。有什么建议么?

 <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Windows" />
    <authorization>     
      <allow verbs="OPTIONS" users="*" />
      <deny users="?" />
    </authorization>
  </system.web>
  <location path="EventReceivers">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
4

1 回答 1

1

您还必须在 location 元素中禁用 Windows 身份验证,如下所示:

<location path="EventReceivers">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
    <system.webServer>
      <security>
        <authentication>
          <windowsAuthentication enabled="false" />
          <anonymousAuthentication enabled="true" />
        </authentication>
      </security>
    </system.webServer>
  </location>
于 2016-02-01T21:08:54.733 回答