18

Is it possible to configure ELMAH with ASP.NET vNext? If so, how?

I am lost as to where even start, given there's not even a web.config anymore. If anyone has or can figure it out, please share with us.

Thank you

1 Answer 1

18

ELMAH does not work with ASP.NET 5 because ELMAH (given its name) is based on ASP.NET 4.x's Modules and Handlers (the "MAH" of "ELMAH").

In ASP.NET 5 the replacement for modules and handlers is called middleware.

There is a prototype in ASP.NET 5 called "ELM" (Error Logging Middleware) that has some features similar to ELMAH. You can check out a sample here: https://github.com/aspnet/Entropy/tree/dev/samples/Logging.Elm

Sign up to request clarification or add additional context in comments.

13 Comments

Hm... this looks more like a replacement to NLog/Log4Net than for ELMAH. i.e. more generic logging vs unhandled exceptions.
I'd say ELM is closer to what ELMAH is trying to do (though ELMAH has way, waaay more features). ELM captures all exceptions in an app, as well as all logs from the new ILogger interface, and shows them in a searchable/filterable web page. The ILogger interface is sort of closer to log4net.
how does one secure the ELM page?
@georgiosd you can put authentication middleware in front of it to add any required authentication and authorization. You'll need to "fork" the middleware pipeline using app.Map() or a similar API, and put the ELM-specific auth middleware and the ELM page in that fork. Then the rest of your app will be on the "main" middleware pipeline with whatever other middleware you have there (e.g. Routing/MVC, diagnostics pages, etc.).
@Elion thank you for the prompt response - do you mind adding an example? My head hurts from reading that, took me two weeks to understand Github forking :)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.