7

我在我的 ASP.NET MVC 站点中启动并运行了 Elmah,我想将它的界面与站点的管理页面集成。默认情况下,您使用 url ~/elmah.axd 调用接口,该接口在 MVC 系统之外运行。安装要求您告诉 MVC 忽略路由,因此没有控制器或任何了解 elmah 的信息。安装建议一个特定的忽略,即使默认情况下它已经被忽略:

public class MvcApplication : System.Web.HttpApplication {
    public static void RegisterRoutes(RouteCollection routes) {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("elmah.axd");
...
}

我想尝试将 elmah.axd 集成为网站的一个组件。我正在考虑有一个 Elmah 控制器,其视图使用 Futures 助手 Html.RenderRoute 但我不确定要传递哪些参数:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Elmah</h2>
    <% Html.RenderRoute(???); %>
</asp:Content>

这有意义吗 - 有没有办法将 url 传递给 Html.RenderRoute?有没有更好的方法不使用 Html.RenderRoute?

4

2 回答 2

7

请在您的视图中尝试此操作:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Elmah</h2>
    <iframe src="<%= Url.Content("~/elmah.axd") %>" frameborder=no width=100% scrolling=auto>
    </iframe>
</asp:Content>
于 2009-07-06T11:51:44.593 回答
1

或者您可以在您的网站上使用它

Elmah 错误日志应用程序

于 2012-10-12T12:00:59.277 回答