4

正如 Phil Haack 在他的博客文章中解释的那样,Route Debugger 有助于可视化您的路由表。
然而,我的网站通过 MVCTurbine 依赖注入(使用 Unity)注入了它的路由,如下所示:

public class DefaultRoutRegistration : IRouteRegistrator
{
    public void Register(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Accounts",
            "Accounts/{userName}/{action}",
            new { controller = "Account", action = "Index" }
            );

        routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );
        RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
    }
}

我到底可以在哪里抛出 RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); 重写我的路由表?

4

1 回答 1

1

对不起,鲍里斯,但当在 StackOverflow 上询问有关涡轮机标签的问题时,我没有通知。:(

是的,这是放置 RouteDebug 块的正确位置。

于 2010-07-14T19:21:47.317 回答