The configuration section ‘customErrors’ cannot be read because it is missing a section declaration – Azure

Hey everyone,

The configuration section ‘customErrors’ cannot be read because it is missing a section declaration

I started receiving this error after I added the following elements to my Web.config file:

  <customErrors>
    <configuration>
      <system.web>
        <customErrors mode="Off"/>
      </system.web>
    </configuration>
  </customErrors>

The problem turned out to be that the custom errors entry actually belongs under system.web. All you actually need to add it the <customErrors mode=”Off”/> part – just make sure it’s under system.web.

<system.web>
 
    <!-- Custom errors under system.web -->
    <customErrors mode="Off"/>
 
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <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>  
  </system.web>

Leave a Reply