凌晨了还在加班!使用MVC2.0实现了伪静态发现本地可以,服务器上不可以了!
windws server 2003 r2 standard x64 edition service pack 2 系统
IIS环境 6.0.
项目版本 .NET 4.0 mvc版本 2.0
伪静态的本地都可以的。发到服务器上,发现只要访问 .html 的页面都不能访问的。
另附上代码:
public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("SiteIndex", "", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); //装修公司首页) routes.MapRoute("ID", "{id}", new { controller = "Shop", action = "index", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站列表页 routes.MapRoute("Action", "{controller}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); //装修公司列表页 routes.MapRoute("Shop3", "{id}/{action}-o{id3}-{id2}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id3 = UrlParameter.Optional }, new { id3 = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop2", "{id}/{action}-o{id3}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id3 = UrlParameter.Optional }, new { id3 = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop1", "{id}/{action}-{id2}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id2 = UrlParameter.Optional }, new { id = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop", "{id}/{action}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id2 = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站详细页 routes.MapRoute("ContrHtml", "{controller}/{id}.html", new { controller = "Home", action = "detail", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); routes.MapRoute("Control", "{controller}/{id}", new { controller = "Home", action = "detail", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站列表页 routes.MapRoute("NoAction", "{controller}/{id}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } }