Asp.net web api elmah.axd/stylesheet未找到错误

Asp.net web api elmah.axd/stylesheet未找到错误,asp.net-web-api,elmah,Asp.net Web Api,Elmah,我刚刚将ELMAH 1.2.2从nuget安装到我的WebApi 2(5.2.3)项目中。它会记录错误,但不会加载elmah.axd的样式表。WebApi显示以下错误: { "message": "No HTTP resource was found that matches the request URI 'http://api.sample.dev/elmah.axd/stylesheet'.", "messageDetail": "No type was found tha

我刚刚将ELMAH 1.2.2从nuget安装到我的WebApi 2(5.2.3)项目中。它会记录错误,但不会加载elmah.axd的样式表。WebApi显示以下错误:

{
    "message": "No HTTP resource was found that matches the request URI 'http://api.sample.dev/elmah.axd/stylesheet'.",
    "messageDetail": "No type was found that matches the controller named 'elmah.axd'."
}

我读了一些,但似乎与我的案例无关。

我通过阻止WebApi路由捕获到*.axd的请求,解决了这个错误

您可以将以下行添加到路由配置中

httpConfig.Routes.IgnoreRoute("DynamicResources", "{resource}.axd/{*pathInfo}");
现在您可以访问elmah.axd的样式表,并拥有样式良好的日志报告页面