tags:

views:

44

answers:

3

I Setup Elmah to work on a website. It works fine on my local machine but when I moved it to a web server I get this exception

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section elmah/security.

Source Error:

Line 110:  </connectionStrings>
Line 111:  <elmah>
Line 112:  <security allowRemoteAccess="1" />
Line 113:    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="CadaretGrantConnectionString"/>
Line 114:    <!-- Don't log 404 -->

It shows me a error at Line 112. What should be done in order to get Elmah to work with remote access?

Below is my configuration

<elmah>
<security allowRemoteAccess="1" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ConnectionString"/>
    <!-- Don't log 404 -->
    <errorFilter>
      <test>
        <equal binding="HttpStatusCode" value="404" valueType="Int32"/>
      </test>
    </errorFilter>

</elmah>
A: 

It might be because your web server is running a different version of IIS. IIS7 (in integrated pipeline mode) needs the Handlers and Modules in the <system.webServer> section, whereas earlier versions need them in <system.web>. Make sure you've added the configurations to the correct section. See http://stackoverflow.com/questions/933554 for more info.

minimalis
A: 

My experience with IIS is limited, so take this with a grain of salt...

The web.config snippet that you've posted looks correct. Based on the error message, it sounds to me like Elmah isn't working at all on your web server. Did you check that you correctly enabled Elmah with a <sectionGroup name="elmah"> block? Did you check that elmah.dll is part of your project?

(It's also important to check <system.webServer>, as described in minimalis's answer, but it doesn't sound like you're even getting that far.)

Josh Kelley
A: 

Turns out for enabling remote access in elmah I not only had to add

  <elmah>
   <security allowRemoteAccess="yes" />
   </elmah>

setion to

but also

<sectionGroup name="elmah">
    <section name="security" type="Elmah.SecuritySectionHandler, Elmah" />
</sectionGroup>

Adding the above section solved my problem

Subbarao