I am not sure what happened to my ELMAH setup, it was working fine, then stopped working. I use ELMAH core and ELMAH MVC.
Even checking my source control, nothing really changed in the webconfig. I also noticed in the actual ELMAH error log database, the records stopped recording from about 11/5 onward. Couldn't find any code changes in source control to coincide with this.
I've got 2 problems, one is when going to myapp/elmah
I got the error:
System.Data.SqlClient.SqlException: Could not find stored procedure 'ELMAH_GetErrorsXml'
Not sure why, because that SPROC definitely exists in my database.
And the web.config appears to be configured correctly to point to that database (will post full sections below).
The second problem is email notifications (and presumably the logging itself) doesn't work when I deploy the application to production. Works fine on localhost. I get the emails, but when deployed to production, nothing.
Here are my ELMAH sections of the web.config:
<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>
<elmah>
<security allowRemoteAccess="yes"/>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahDb" />
<errorMail from="no-reply@mysite" to="myself@mysite" subject="Mysite Error" smtpPort="0" async="false" />
</elmah>
<connectionStrings>
<add name="ElmahDb" connectionString="Data Source=mydb;Initial Catalog=ErrorLog;Persist Security Info=True;User ID=id;Password=password" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.route" value="elmah" />
</appSettings>
<system.web>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network defaultCredentials="true" host="mySMTP" port="25" />
</smtp>
</mailSettings>
</system.net>
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
That's it, the only other thing I've seen mentioned is comment out the default HandleErrorAttribute, but those seem to be from old articles and ELMAH MVC removes the need for that anyway, regardless I've tried both leaving it and commenting it out:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
It still functions the same.I've also tried enabling/disabling remoteAccess for ELMAH but that doesn't do anything either. On both localhost and production I get the same error when trying to access /elmah
. And Emails only send on localhost. So what is wrong with my configuration and why am I getting these errors?