Tried to implement ELMAH - keep getting IIS HTTP 500.22 Error


I have the following in my web.config:

<?xml version="1.0" encoding="utf-8"?>
  For more information on how to configure your ASP.NET application, please visit
    <!-- For more information on Entity Framework configuration, visit -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false"
        type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false"
        type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false"
        type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false"
        type="Elmah.ErrorFilterSectionHandler, Elmah" />
    <security allowRemoteAccess="yes" />
    <errorLog type="Elmah.SqlErrorLog, Elmah"
    connectionStringName="PhumafConnectionString" />
      subject="Application Exception"
      useSsl="true" />
      <smtp deliveryMethod="Network">
        <network host="" port="587" userName="*********" password="********" />
    <add name="PhumafEntities" connectionString="metadata=res://*/PhumafDB.csdl|res://*/PhumafDB.ssdl|res://*/PhumafDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DRAGAN-THINK\SQLEXPRESS;initial catalog=Phumaf;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;"
      providerName="System.Data.EntityClient" />
    <add name="PhumafConnectionString" connectionString="Data Source=DRAGAN-THINK\SQLEXPRESS;Initial Catalog=Phumaf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework"
      providerName="System.Data.SqlClient" />
    <customErrors mode="On" defaultRedirect="~/genericError.aspx">
      <error statusCode="404" redirect="~/404.aspx" />
      <add verb="POST,GET,HEAD" path="elmah.axd"
  type="Elmah.ErrorLogPageFactory, Elmah" />
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
    <compilation debug="true" targetFramework="4.5">
        <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <httpRuntime targetFramework="4.5" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

Also I added Elmah.dll to the bin folder. Whenever I run the application I get the IIS error screen containing the following messages :

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.

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

Validated that my XML is valid and it is 100% valid :/

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.
asked on Stack Overflow Dec 12, 2012 by Dragan • edited Jun 3, 2015 by John Saunders

1 Answer


check out the following two links


The essential part of solving this error is as follows

1) ASP.NET applications require migration when specifying configuration in or . You will receive a 500 – Internal Server Error. This can include HTTP Error 500.22, and HTTP Error 500.23: An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. It occurs because ASP.NET modules and handlers should be specified in the IIS and configuration sections in Integrated mode. Workaround: 1) You must migrate the application configuration to work properly in Integrated mode. You can migrate the application configuration with AppCmd:

%windir%system32inetsrvAppcmd migrate config “”

answered on Stack Overflow Dec 12, 2012 by Mike Beeler • edited Jun 3, 2015 by Mike Beeler

User contributions licensed under CC BY-SA 3.0