正如 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); 重写我的路由表?