2

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:

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:

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

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. 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>
Community
  • 1
  • 1
Mr. Mr.
  • 4,257
  • 3
  • 27
  • 42
  • What are you hosting the site on: Azure VM? Azure Cloud Service Web Role or Azure Web Site? – viperguynaz Jun 28 '14 at 16:20
  • @viperguynaz Azure Web Site – Mr. Mr. Jun 29 '14 at 15:10
  • Could you please have a look at my answer on [ASP MVC in IIS 7 results in: HTTP Error 403.14 - Forbidden](http://stackoverflow.com/questions/1741439/asp-mvc-in-iis-7-results-in-http-error-403-14-forbidden/41363973#41363973). – Murat Yıldız Dec 28 '16 at 14:23

2 Answers2

2

I could not see the wood for the trees!

In my _Layout I saw a RenderAction which had Authorize on it.

It was this attribute that was causing the 401, unfortunately, it was not very obvious.

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/

Mr. Mr.
  • 4,257
  • 3
  • 27
  • 42
1

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. 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.

Also, since you are using RavenDB, take a look at these SO posts about Azure Web sites and embedded RavenDB.

Community
  • 1
  • 1
viperguynaz
  • 12,044
  • 4
  • 30
  • 41
  • thanks for your input, I have removed those lines as you suggested but they did not fix my issue, however I had been looking into my problem and found the solution, I will answer my own question. – Mr. Mr. Jul 10 '14 at 16:06