asp.net - Azure 上托管的 MVC 4 网站显示我无权查看目录或页面

标签 asp.net asp.net-mvc iis azure

由于我的 FTP 凭据被锁定,我当前无法查看日志,但在尝试查看主页时我只看到以下消息:

You do not have permission to view this directory or page.

我查看了有关 SO 的其他问题,并进行了一些谷歌搜索(收效甚微),发现了以下内容:

ASP.NET 4.5 MVC 4 not working on Windows Server 2008 IIS 7

http://www.iis.net/learn/get-started/introduction-to-iis/iis-modules-overview#Precondition

不幸的是,我无法找到使我的页面正常运行的修复程序。我相信这是一个 IIS“东西”,我可以通过 web.config 进行控制,但我不知道它可能是什么。请,请,请帮助我,向我询问我尚未提供的关键信息,我不确定可能还需要哪些其他信息来进一步诊断我的问题。

这是我的配置文件:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="blahblahblah" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <log4net configSource="log4net.config" />
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="enableSimpleMembership" value="false" />
  </appSettings>
  <!--
    For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5.1" />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <membership defaultProvider="RavenDBMembership">
      <providers>
        <clear />
        <add name="RavenDBMembership" applicationName="Website123" type="Mag.Escrow.Web.RavenProvider.Provider.RavenDBMembershipProvider" />
      </providers>
    </membership>
    <profile>
      <providers>
        <clear />
      </providers>
    </profile>
    <roleManager enabled="true" defaultProvider="RavenDBRole">
      <providers>
        <clear />
        <add name="RavenDBRole" applicationName="WebSite123" type="Mag.Escrow.Web.RavenProvider.Provider.RavenDBRoleProvider" />
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
      <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

最佳答案

只见树木不见森林!

在我的_Layout中,我看到一个RenderAction,上面有Authorize

正是这个属性导致了 401,不幸的是,它不是很明显。

我确信这里一定有一个答案,如果你能找到它,请把它链接到这里供其他人找到,因为我找不到。

http://blogin.codeinside.eu/2011/09/06/fix401-unauthorized-access-is-denied-due-to-invalid-credentials-on-asp-net-mvc-iis-7/

关于asp.net - Azure 上托管的 MVC 4 网站显示我无权查看目录或页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24458697/

相关文章:

c# - 在 Application_End 中检测站点登录 url

asp.net - HttpModule 是否在工作线程之间共享?

ASP.NET 4.5 MVC 4 无法在 Windows Server 2008 IIS 7 上运行

asp.net - 使用ajax实现搜索和搜索结果的好方法有哪些?

javascript - ASP.NET 使用哪个版本的 Javascript?

c# - 如何将模型传递给另一个区域的 Controller ?

c# - ASP.NET Identity - 匿名配置文件

asp.net - 在asp.net中验证

c# - 如何在 JSON 的 ServiceStack 中返回具有 TimeZoneInfo 属性的 DTO

asp.net-mvc - 无法将文件 .mdf 作为数据库附加