2017-04-18 41 views
1

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

{ 
    "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'." 
} 

我看了一些answers但似乎并不涉及到我的情况。

回答

1

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

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

httpConfig.Routes.IgnoreRoute("DynamicResources", "{resource}.axd/{*pathInfo}"); 

现在您可以访问elmah.axd的样式表,并有完善的样式日志报表页面。