Logging to elmah.io from ASP.NET MVC
Even though ELMAH works out of the box with ASP.NET MVC, ELMAH and MVC provide some features which interfere with one another. As usual, the great community around ELMAH has done something to fix this, by using the Elmah.Mvc NuGet package. We've built a package for ASP.NET MVC exclusively, which installs all the necessary packages.
To start logging exceptions from ASP.NET MVC, install the
Elmah.Io.Mvc NuGet package:
dotnet add package Elmah.Io.Mvc
<PackageReference Include="Elmah.Io.Mvc" Version="4.*" />
paket add Elmah.Io.Mvc
As part of the installation, we also installed
Elmah.MVC, which adds some interesting logic around routing and authentication. Take a look in the
web.config for application settings with the
elmah.mvc. prefix. For documentation about these settings, check out the Elmah.MVC project on GitHub.
Elmah.MVC configures an URL for accessing the ELMAH UI (just
/elmah and not
/elmah.axd), you can remove the
location element in
web.config, added by the
Elmah.Io.Mvc NuGet package installer.
This article was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening, and help you fix errors fast.