Elmah.MVC does not log errors in production environment - asp.net-mvc

I installed Elmah.MVC to my MVC project using Elmah.MVC Nuget package. It works fine in development environment, but when I upload website to hosting server (IIS7) it does not log errors.
This is my web config file (only the Elmah configuraion),
<?xml version="1.0" encoding="utf-8"?>
<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>
<connectionStrings>
...
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
</appSettings>
<system.web>
<customErrors mode="Off">
</customErrors>
...
<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.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<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>
...
<elmah>
<security allowRemoteAccess="yes" />
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/Elmah.Errors" />
</elmah>
<location path="elmah.axd" inheritInChildApplications="false">
<system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
</configuration>
Can someone please check & tell why it is not logging errors in Hosting environment?

Does your application have write access to the App_Data directory in your production environment?
Based on your configuration, you are not logging to SQL -> the application pool identity will need to be able to modify/write to files in order to append to the App_Data/Elmah.Errors file. More information on the why and how.

I had a similar problem. I was using this line:
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~\App_Data\Elmah.Errors" />
Wrong. You must use slash:
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/Elmah.Errors" />
This should be a comment, but I have not enough rep.

Related

Elmah.MVC returns 403 in Local Environment

I have installed Elmah.MVC into a project I'm working on and tried to browse to /elmah but am constantly greeted by this error:
You are attempting to access ELMAH from a remote machine whereas itis
currently configured not to allow remote access. You can enableremote
access by adding the following sections to this web
site'sconfiguration file:
<configuration>
<configSections>
…
<sectionGroup name="elmah">
<section name="security" type="Elmah.SecuritySectionHandler, Elmah" />
</sectionGroup>
…
</configSections>
<elmah>
<security allowRemoteAccess="yes" />
</elmah>
…
</configuration>
The thing is, I'm running the application in Debug mode on my Local Machine and not remotely.
My Web Config looks as follows:
<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>
......
<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.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
......
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
......
<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>
......
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah" />
<security allowRemoteAccess="false" />
</elmah>
</configuration>
I've used Elmah before in other projects without encountering this issue. I'm using Visual Studio 2017, MVC5 and .NET Framework 4.5.2
Anyone have any ideas?
I HAD the same issue. I was definitively accessing locally, I tried "localhost" and "127.0.0.1".
But I could make it work with another smaller MVC project, at least remotely.
Comparing both, I noticed differences in the version of elmah.corelibrary, and I believe now that the latest version, 1.2.2 causes the issue.
So, I replaced 2 dll and have now
Elmah.dll v1.2 (v1.2.13605.2128) (instead of 1.2.2 or 1.2.14706.0?)
Elmah.Mvc.dll v2.1.2
and updated package.config :
<package id="elmah.corelibrary" version="1.2" targetFramework="net461" />
<package id="Elmah.Mvc" version="2.1.2" targetFramework="net461" />
In the Root web.config, I have the following lines related to elmah
in the configSections section :
<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>
in the appSettings section :
<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.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
in the system.web section :
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
in the system.webserver section :
<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>
and under configuration
<elmah>
<security allowRemoteAccess="true" />
</elmah>
I struggled a lot to make it all work. This last attribute can of course be set to false (and it still works locally)
I hope it works for you!

Elmah does not work in MVC5

I have VS2015 with MVC5 and I installed Nuget package Elmah.MVC
But I am not able to get it to work.
When I submit URL address
localhost:<port>/Elmah.axd
the error appear
HTTP Error 404.0 - Not Found
in web.config by default nugget package added this
<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>
...
<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.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
<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>
I added manually this, because I tried to fix the error and also want to store application errors in the SQL database
<system.web>
...
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
...
</system.web>
<configuration>
...
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionStringName="database"
applicationName="MyAppName"/>
</elmah>
</configuration>
What am I missing ?
I recently installed and your config looks similar except I have these:
<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>
.
.
.
<elmah>
<security allowRemoteAccess="yes" />
</elmah>
</configuration>
I do not have the entries you manually added.

Having issue with Parent Child Website configuration Asp.Net MVC

I Have an Asp.Net MVC .Net 4.5 Web Application as http://parent.com where I recently had to create a child url for it to work like this: http://parent.com/tadecide/
In order to get the child web application to work I had to add this to the parent web application web.config.
<location path="." inheritInChildApplications="false">
<system.web>...</system.web>
<system.webServer>...</system.webServer>
</location>
I am able to access both web sites but the issue I am experiencing is that on http://parent.com it can no longer access the root folders of the site such as : images, content, scripts and therefore there is only text on the website and no images, content and scripts are loaded.
Configuration: Windows Server 2008 R2 Standard, IIS 7, Parent Websites is Asp.Net MVC .Net 4.5 and Child Website is Asp.Net MVC .Net 4.5.1
My web.config for http//parent.com is below
<?xml version="1.0" encoding="UTF-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, 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" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="MvcMailer.BaseURL" value="" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="true" />
<add key="elmah.mvc.allowedRoles" value="Contractor" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="Administrator/elmah" />
</appSettings>
<connectionStrings>
<add name="MyMasterContext" connectionString="Data Source=.;Initial Catalog=MyCatalog;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<location path="." inheritInChildApplications="false">
<system.web>
<sessionState timeout="35" />
<customErrors mode="RemoteOnly" redirectMode="ResponseRewrite" />
<authentication mode="None" />
<compilation targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="DevExpress.Web.ASPxThemes.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.ASPxHtmlEditor.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.Mvc5.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Utils.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Data.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.ASPxSpellChecker.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.SpellChecker.v13.1.Core, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" enableVersionHeader="false" maxRequestLength="15730" />
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="System.Collections.Generic" />
<add namespace="System.Collections" />
<add namespace="System.Drawing" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="DevExpress.Utils" />
<add namespace="DevExpress.Web.ASPxHtmlEditor" />
<add namespace="DevExpress.Web.Mvc" />
<add namespace="DevExpress.Web.Mvc.UI" />
</namespaces>
</pages>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
<add name="RemoveCustomHeader" type="RemoveCustomHeader" />
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</httpModules>
<machineKey validationKey="56A706A6B565B7C79FEC1E28E40AD3F589734320CC14BF85D5878FD6428D1E65F45C83EEDF29E7E1DE2C160070EB5D967AE0D1AF2D1925019BFF8D1C887DEAC0" decryptionKey="4B5A667F9B40CEDB280749D24F80A79F89176797EE54725B8C5DA5966269E383" validation="SHA1" decryption="AES" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
<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" />
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="SAMEORIGIN" />
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</location>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.net>
<mailSettings>
<smtp from="email#email.com">
<network host="mail.server" enableSsl="true" port="25" defaultCredentials="false" userName="email#email.com" password="mypass" />
</smtp>
</mailSettings>
</system.net>
<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/Errors" />
<security allowRemoteAccess="true" />
</elmah>
I figured this out.
Right after the tag and before I entered these tags with the names of the root folders
<location path="Content">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script">
<remove name="StaticFile" />
</handlers>
</system.webServer>
</location>
<location path="fonts">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script,Read">
<clear />
<remove name="StaticFile" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read"/>
</handlers>
</system.webServer>
</location>
<location path="Images">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script,Read">
<remove name="StaticFile" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read"/>
</handlers>
</system.webServer>
</location>
<location path="Scripts">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script,Read">
<remove name="StaticFile" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read"/>
</handlers>
</system.webServer>
</location>

elmah only sending emails for "page not found" errors

I have Elmah set up in my web.config to send me emails on errors. However, for some reason I only get emails when I type in a bogus page after the domain name. Any other errors, and I see my custom error page on the site, so I am I am getting an error, but no email. Can anyone see what I am doing wrong?
Here is the relevant web.config code:
<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>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="500" path="/Errors/Error" responseMode="ExecuteURL" />
<error statusCode="404" path="/Errors/Error" responseMode="ExecuteURL" />
</httpErrors>
<modules runAllManagedModulesForAllRequests="true">
<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>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="relay-hosting.secureserver.net" port="25" />
</smtp>
</mailSettings>
</system.net>
<elmah>
<errorMail from="from email"
to="to email"
subject="Application Error"
async="true"
smtpPort="0"
/>
<security allowRemoteAccess="false" />
<errorFilter>
<text>
</text>
</errorFilter>
</elmah>
<location path="elmah.axd" inheritInChildApplications="false">
<system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<authorization>
<allow roles="admin" />
<deny users="*" />
</authorization>
</system.web>
<system.webServer>
<handlers>
<add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
</configuration>
Remove this from the web.config elmah section:
<errorFilter>
<text>
</text>
</errorFilter>
I am assuming that the empty node is defaulting to filter 404 for some reason, but I haven't tested it.

No able to run Elmah on .Net MVC 3

I' m using Elmah https://github.com/alexanderbeletsky/elmah.mvc for a MVC .net project.
For log/in the error I'm using MS SQL.
After installing the Database and installing Elmah through NutGet, I'not able to visualize the error in the database.
Here my Web.Config could you tell me what I'm doingwrong here? Thanks
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<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>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="MyProjectEventsMobileEntities" connectionString="metadata=res://*/Models.EventsCustom.csdl|res://*/Models.EventsCustom.ssdl|res://*/Models.EventsCustom.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=MyProjectEventsMobile;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<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.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<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>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<elmah></elmah>
</configuration>
You need to configure elmah to use your database for the logging:
In your config extend <elmah></elmah> to:
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionStringName="MyProjectEventsMobileEntities" />
</elmah>
You can find more option in the ELMAH sample web.config and in the ErrorLogImplementations wiki article.

Resources