2

I Just installed ELMAH 1.2.2 from nuget to my WebApi 2 (5.2.3) project. It logs errors but elmah.axd's stylesheet doesn't load. And WebApi shows the following error:

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

I read some answers but doesn't seems related to my case.

Community
  • 1
  • 1
Ahmad Ahmadi
  • 337
  • 1
  • 4
  • 19

1 Answers1

2

I solved this error by preventing the WebApi's routing from catching requests to *.axd.

You can add the following line to your routing config.

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

Now you can access elmah.axd's stylesheet and have a well styled log report page.

Ahmad Ahmadi
  • 337
  • 1
  • 4
  • 19