You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 }
);
}
}
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: