public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Root", "", new {controller = "Home", action = "Index", id = UrlParameter.Optional}, namespaces: new string[] { "Jxrlzy.Controllers" } ); //根目录匹配 routes.MapRoute( "Controller1Html", // action伪静态 "{controller}.html", // 带有参数的 URL new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值 namespaces: new string[] { "Jxrlzy.Controllers" } ); routes.MapRoute( "Action1Html", // action伪静态 "{controller}/{action}.html", // 带有参数的 URL new {controller = "Home", action = "Index", id = UrlParameter.Optional}, // 参数默认值 namespaces: new string[] {"Jxrlzy.Controllers"} ); routes.MapRoute( "Action", // action伪静态 "{controller}/{action}", // 带有参数的 URL new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值 namespaces: new string[] { "Jxrlzy.Controllers" } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}.html", defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional}, namespaces: new string[] {"Jxrlzy.Controllers"} ); ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder()); }