Elmah nuget package doesn't update web.config

3

Background / Goal

I have an asp.net 4.5 web forms project that's now under the asp.net one architecture (so we're integrating MVC in a few parts).

I am attempting to add Elmah to this setup. My goals are:

  • to log 50 errors in memory, with local access only,
  • to log all errors to a SQL database (which we've set up with the Elmah scripts).
  • To capture both WebForms and MVC error output into Elmah.

Problem

However, when I add the Elmah package via nuget, it does not appear to make any modifications to web.config. So, when I browse to /elmah.axd, I see:

Path '/elmah.axd' was not found. System.Web.HttpException (0x80004005): Path '/elmah.axd' was not found. at System.Web.HttpNotFoundHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This makes sense, because web.config hasn't been modified to add the handlers.

However, adding elmah.axd does give us an MVC route. However, my instincts and some rudimentary tests tell me that these only cover errors within the purview of MVC.

Question(s)

  • How can I properly configure elmah in this instance so that elmah and elmah.mvc packages both worth as desiged?
asp.net
asp.net-mvc
configuration
webforms
elmah
asked on Stack Overflow Jan 21, 2014 by SeanKilleen

2 Answers

1

it could be related to the existing sections/elements of your original web.config file, so that the web.config.transform in the Elmah package could not perform some of the add operations.

This document - http://docs.nuget.org/docs/creating-packages/configuration-file-and-source-code-transformations described explicitly what the Elmah package transformation will do, for web.config before and after.

answered on Stack Overflow Jan 30, 2014 by Dan Liu
0

Well this happened to me too, I did 3 things.

  1. Went to "Manage NuGet Packages" for your project, delete everything about Elmah.
  2. Restarted visual studio, and opened it with admin priviliges. ( not sure if it was this). Make sure your web.config is not opened, for some reason VS was not updating it.
  3. Run install-package elmah on Package Manager Console again.

And after that my web config is updated and everything runnning smoothly.

answered on Stack Overflow Oct 19, 2019 by andrecj

User contributions licensed under CC BY-SA 3.0