ELMAH:Elmah页面的样式不佳,难以阅读 [英] ELMAH: Elmah pages not styled making them difficult to read

查看:92
本文介绍了ELMAH:Elmah页面的样式不佳,难以阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已通过NuGet在ASP.NET MVC 4站点上安装了ELMAH。

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

在开发机器上,应用程序安装在根目录下。一切正常,其样式通常与ELMAH页面相同。

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?

但是在服务器上,该应用程序安装在子文件夹(〜/ tracker)中,所以它总是能在开发机器上正常工作吗? 。尽管ELMAH可以正常工作,但是页面未设置样式,因此难以阅读。

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.

该怎么办我需要做的是设置页面样式吗?

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

大概是,样式来自可以在web.config中配置的资源。但是如何?

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

我发现我遇到了一个高度相关的错误:

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'.

路径为:

/tracker/elmah/stylesheet

这显然与ELMAH页面的源中的链接标记:

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" />

但是如何配置此网址?

推荐答案

您的 elmah.mvc.route设置是什么?如果您从路径中删除 / tracker,是否可以看到elmah屏幕?

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

开箱即用,elmah的路由设置为:

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

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

您需要成为

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

您的路由配置正确地重定向了对控制器操作的请求,但是elmah会打印样式表地址本身而不使用您的路由配置,因此您需要告诉它要使用哪个路由/ URL作为其引用。

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.

这篇关于ELMAH:Elmah页面的样式不佳,难以阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆