2017-04-18 46 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的樣式表,並有完善的樣式日誌報表頁面。