[英]MVC 4 website hosted on Azure says I do not have permission to view directory or page
I am not able to currently see my logs as my FTP credentials are locked out, but all I am seeing the following message when trying to view my home page: 由于我的FTP凭据已被锁定,我目前无法查看日志,但是在尝试查看我的主页时,我仅看到以下消息:
You do not have permission to view this directory or page.
您无权查看此目录或页面。
I have looked at the other questions on SO and done some googling (to little avail) and found the following: 我查看了有关SO的其他问题,并进行了一些Google搜索(无济于事),发现了以下内容:
ASP.NET 4.5 MVC 4 not working on Windows Server 2008 IIS 7 ASP.NET 4.5 MVC 4在Windows Server 2008 IIS 7上不起作用
http://www.iis.net/learn/get-started/introduction-to-iis/iis-modules-overview#Precondition http://www.iis.net/learn/get-started/introduction-to-iis/iis-modules-overview#Precondition
Unfortunately, I have been unable to find a fix to get my page working. 不幸的是,我无法找到使页面正常工作的修复程序。 I believe it is an IIS 'thing' that i could probably control via the web.config but I do not know what it could be.
我相信这是我可以通过web.config进行控制的IIS“东西”,但我不知道它可能是什么。 Please, please, please help me, ask me for key bits of info I have not already provided I am not sure what other bit may be required to diagnose my problem further.
请,请,请帮助我,请我提供我尚未提供的关键信息,我不确定进一步诊断我的问题可能还需要什么其他信息。
Here is my configuration file: 这是我的配置文件:
<?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>
I could not see the wood for the trees! 我看不见树木的树木!
In my _Layout I saw a RenderAction
which had Authorize
on it. 在我的_Layout中,我看到了具有
Authorize
的RenderAction
。
It was this attribute that was causing the 401, unfortunately, it was not very obvious. 正是这个属性导致了401,不幸的是,它不是很明显。
I am sure there must have been an answer here on SO, please, if you can locate it then link it here for others to find as I cannot. 我敢肯定,在这里一定要有一个答案,如果您能找到它,请在这里链接它,以供其他人查找,因为我找不到。
http://blogin.codeinside.eu/2011/09/06/fix401-unauthorized-access-is-denied-due-to-invalid-credentials-on-asp-net-mvc-iis-7/ http://blogin.codeinside.eu/2011/09/06/fix401-unauthorized-access-is-denied-due-to-invalid-credentials-on-asp-net-mvc-iis-7/
remove the 4 lines related to ExtensionlessUrlHandler-ISAPI-4.0_32bit & ExtensionlessUrlHandler-ISAPI-4.0_64bit - refer to How to: Change configuration options for a web site . 删除与ExtensionlessUrlHandler-ISAPI-4.0_32bit和ExtensionlessUrlHandler-ISAPI-4.0_64bit相关的4行-请参阅如何:更改网站的配置选项 。 You shouldn't try to configure both Classic and Integrated modes.
您不应尝试同时配置经典模式和集成模式。 By default, Azure web sites run in Integrated mode - you should use the Classic option only if you have legacy web sites that run exclusively on older versions of IIS.
默认情况下,Azure网站以集成模式运行-仅当您拥有仅在IIS的旧版本上运行的旧网站时,才应使用“经典”选项。
Also, since you are using RavenDB, take a look at these SO posts about Azure Web sites and embedded RavenDB . 另外,由于您正在使用RavenDB,因此请查看有关Azure网站和嵌入式RavenDB的这些SO帖子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.