Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELMAH on ASP.NET vNext?

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

like image 227
georgiosd Avatar asked Mar 06 '15 20:03

georgiosd


People also ask

Does ELMAH work with .NET core?

ELMAH doesn't support ASP.NET Core.

How do I use ELMAH in Web API?

There are two options by using ELMAH to capture exceptions in WEB API. If you want to capture errors that are encountered in Actions and Controllers , i.e. in your business logic you can create a ActionFilterAttribute and log those exceptions to ELMAH. Then wireup by adding that filter.

What is the use of ELMAH?

Elmah (which stands for Error Logging Modules and Handlers) is a pluggable error management framework. Because Elmah can be used to attach error logging capabilities to your application without having to re-compile or re-deploy, it makes the process of detecting application errors almost seamless.


1 Answers

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

like image 129
Eilon Avatar answered Sep 18 '22 22:09

Eilon