asp.net mvc项目实记

百度这些东西,还是会浪费了一些不必要的时间,记录记录以备后续

一、开启伪静态

如果不在web.config中配置管道开关则伪静态无效

  1. 首先在RouteConfig.cs中中注册路由

    1
    2
    3
    4
    5
    routes.MapRoute(
    name: "index",
    url: "index.html",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
  2. 在web.config中的system.webServer节点添加配置项

    1
    2
    3
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>