MVC 路由设置伪静态
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("Defaults", "{controller}/{id}.html", new { controller = "Home", action = "Info", id = UrlParameter.Optional }, new { controller = @"News|Solutions" }, new[] { "Web.UI" }); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[1] { "Web.UI" } ); }
然后在Web.config 的<system.webServer>节点下添加<modules runAllManagedModulesForAllRequests="true" />
iis中应用池模式改为集成模式,并在处理程序中添加通配符