ELMAH: Elmah pages not styled making them difficult to read

时光总嘲笑我的痴心妄想 提交于 2019-12-22 04:22:16

问题


Setup:

I have ELMAH installed via NuGet on an ASP.NET MVC 4 site.

On the dev machine the app is installed at the root. It all works and is styled as ELMAH pages usually are. It always does that, work on the dev machine I mean, doesn't it?

But on the server, the app installed in a sub folder (~/tracker). Although ELMAH works fine, the pages are unstyled, making them difficult to read.

Question:

What do I need to do to get the pages to style?

Presumably, the styling comes from a resource that can be configured in the web.config. But how?

Edit:

I have found that I am getting a highly relevant error:

System.Web.HttpException: A public action method 'stylesheet' was not found on controller 'Elmah.Mvc.ElmahController'.

The path is given as:

/tracker/elmah/stylesheet

This is obviously related to the Link tag in the source of the ELMAH pages:

<link rel="stylesheet" type="text/css" href="/tracker/elmah/stylesheet" />

But how do I configure this url?


回答1:


What is your "elmah.mvc.route" setting? Can you see the elmah screen if you remove "/tracker" from your path?

Out of the box, elmah's route setting is:

<add key="elmah.mvc.route" value="elmah" />

Yours needs to be

<add key="elmah.mvc.route" value="tracker/elmah" />

Your route configuration is correctly redirecting requests for controller actions, but elmah prints the stylesheet address itself without using your route config, so you'll need to tell it what route/URL to use for its references.



来源:https://stackoverflow.com/questions/14875750/elmah-elmah-pages-not-styled-making-them-difficult-to-read

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!