Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elmah not logging 404 Not Found errors when using MVC Attribute Routing #60

Open
RehanSaeed opened this issue Apr 13, 2015 · 0 comments

Comments

@RehanSaeed
Copy link

All errors seem to be logged in Elmah except 404 Not Found errors. I have now narrowed this error down to a routing problem. I am using attribute routing only and do not have any calls to System.Web.MvcRouteCollectionExtensions.MapRoute anywhere in my routing configuration. As soon as I add the default MapRoute code back in, 404 Not Found errors are logged once more.

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("Content/{*pathInfo}");
        routes.IgnoreRoute("Scripts/{*pathInfo}");
        routes.IgnoreRoute("elmah");

        routes.MapMvcAttributeRoutes();

        // Removing the line below stops Elmah from logging 404 Not Found errors.
        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}
@RehanSaeed RehanSaeed changed the title Elmah not logging 404 Not Found errors Elmah not logging 404 Not Found errors when using MVC Attribute Routing Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant