title: Tried to implement ELMAH - keep getting IIS HTTP 500.22 Error
body: <p>I have the following in my web.config: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    --&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;sectionGroup name="elmah"&gt;
        &lt;section name="security" requirePermission="false"
          type="Elmah.SecuritySectionHandler, Elmah" /&gt;
        &lt;section name="errorLog" requirePermission="false"
          type="Elmah.ErrorLogSectionHandler, Elmah" /&gt;
        &lt;section name="errorMail" requirePermission="false"
          type="Elmah.ErrorMailSectionHandler, Elmah" /&gt;
        &lt;section name="errorFilter" requirePermission="false"
          type="Elmah.ErrorFilterSectionHandler, Elmah" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;elmah&gt;
      &lt;security allowRemoteAccess="yes" /&gt;
      &lt;errorLog type="Elmah.SqlErrorLog, Elmah"
      connectionStringName="PhumafConnectionString" /&gt;
      &lt;errorMail
        from="*******"
        to="*********"
        subject="Application Exception"
        async="false"
        smtpPort="0"
        useSsl="true" /&gt;
    &lt;/elmah&gt;
    &lt;system.net&gt;
      &lt;mailSettings&gt;
        &lt;smtp deliveryMethod="Network"&gt;
          &lt;network host="smtp.gmail.com" port="587" userName="*********" password="********" /&gt;
        &lt;/smtp&gt;
      &lt;/mailSettings&gt;
    &lt;/system.net&gt;
    &lt;connectionStrings&gt;
      &lt;add name="PhumafEntities" connectionString="metadata=res://*/PhumafDB.csdl|res://*/PhumafDB.ssdl|res://*/PhumafDB.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=DRAGAN-THINK\SQLEXPRESS;initial catalog=Phumaf;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&amp;quot;"
        providerName="System.Data.EntityClient" /&gt;
      &lt;add name="PhumafConnectionString" connectionString="Data Source=DRAGAN-THINK\SQLEXPRESS;Initial Catalog=Phumaf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework"
        providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
    &lt;system.web&gt;
      &lt;customErrors mode="On" defaultRedirect="~/genericError.aspx"&gt;
        &lt;error statusCode="404" redirect="~/404.aspx" /&gt;
      &lt;/customErrors&gt;
      &lt;httpHandlers&gt;
        &lt;add verb="POST,GET,HEAD" path="elmah.axd"
    type="Elmah.ErrorLogPageFactory, Elmah" /&gt;
      &lt;/httpHandlers&gt;
      &lt;httpModules&gt;
        &lt;add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" /&gt;
        &lt;add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" /&gt;
      &lt;/httpModules&gt;
      &lt;compilation debug="true" targetFramework="4.5"&gt;
        &lt;assemblies&gt;
          &lt;add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
        &lt;/assemblies&gt;
      &lt;/compilation&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
    &lt;/system.web&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
    &lt;/entityFramework&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Also I added Elmah.dll to the bin folder. Whenever I run the application I get the IIS error screen containing the following messages :</p>
  
  <pre><code>HTTP Error 500.22 - Internal Server Error
  An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
  
  Most likely causes:
  This application defines configuration in the system.web/httpModules section.
  </code></pre>
  
  <hr>
  
  <pre><code>Detailed Error Information:
  Module     ConfigurationValidationModule
  Notification       BeginRequest
  Handler    PageHandlerFactory-Integrated-4.0
  Error Code     0x80070032
  Requested URL      http://localhost:13094/index.aspx
  Physical Path      c:\users\dragan\documents\visual studio 2012\Projects\WebApplication2\WebApplication2\index.aspx
  Logon Method       Not yet determined
  Logon User     Not yet determined
  Request Tracing Directory      C:\Users\Dragan\Documents\IISExpress\TraceLogFiles\WEBAPPLICATION2
  </code></pre>
  
  <p>Validated that my XML is valid and it is 100% valid :/</p>
  
  <p>I really don't know what went wrong. It used to be all okay until I tried to implement Elmah. I'm starting to lose my mind, please do help if you see what I did wrong.</p>