Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELMAH works on local machine, but not on production [duplicate]

Simple set up, I'm using ELMAH to log exceptions and send me e-mails. Everything works fine on my local machine, but when I put the changes on my production server, errors don't get logged and I don't get e-mails.

Here's my web.config on my local machine:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <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" />
        </sectionGroup>
    </configSections>

    <elmah>
        <security allowRemoteAccess="0" />
        <errorLog type="Elmah.SqlErrorLog, Elmah"
            connectionStringName="MyDB" />
        <errorMail from="[email protected]" to="[email protected]"
            subject="Error" smtpServer="localhost" smtpPort="25" 
            userName="[email protected]" password="mypassword" />
    </elmah>

    <connectionStrings>
        <add name="MyDB" connectionString="Data Source=.\SQLEXPRESS
            AttachDbFilename=|DataDirectory|\MyDB.mdf;
            Integrated Security=True;User Instance=True;
            MultipleActiveResultSets=True"
            providerName="System.Data.SqlClient" />
        <!--<add name="MyDB" connectionString="Server=mysite.com;
            Database=MyDB;User ID=user;Password=mypassword;
            Trusted_Connection=True;Integrated Security=False;
            MultipleActiveResultSets=True"
            providerName="System.Data.SqlClient" />-->
    </connectionStrings>

    <system.web>  
        <!--<httpHandlers>
            <add verb="POST,GET,HEAD" path="elmah.axd" 
                type="Elmah.ErrorLogPageFactory, Elmah" />
        </httpHandlers>-->
        <httpModules>
            <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
        </httpModules>
    </system.web>

    <location path="Admin/Errors">
        <system.web>
            <httpHandlers>
                <add verb="POST,GET,HEAD" path="elmah.axd"
                    type="Elmah.ErrorLogPageFactory, Elmah" />
            </httpHandlers>
        </system.web>
    </location>
</configuration>

The only difference between the web.config on my machine and on production is the connection string being used. On my machine, I'm connecting to a .mdf file. On production, I'm connecting to an external database.

Can anyone see what I'm doing wrong here?

I'm using C# and ASP.NET MVC 3

like image 681
Steven Avatar asked Jan 19 '23 23:01

Steven


1 Answers

You need to set allowRemoteAccess ="yes" for remote access.

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

And check the elmah admin page to see if that helps you.

Example access: http://prodserver/elmah.axd

like image 145
Michael D. Irizarry Avatar answered Jan 30 '23 23:01

Michael D. Irizarry