国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Asp.netMVC4新項目中創建area的后續操作

2019-11-14 14:25:41
字體:
來源:轉載
供稿:網友

asp.net MVC 4新項目中創建area后,往往HomeController與area的HomeController路由發生混淆,需要手工設置一些地方避免mvc無法識別默認路由的狀況。

無廢話具體步驟:

1. 檢查早Global.asax和/App_Start/RouteConfig.cs中是否已經自動添加了AreaRegistration.RegisterAllAreas();如不存在,進入第2步,否則第3步

2. 在/App_Start/RouteConfig.cs中,添加AreaRegistration.RegisterAllAreas();

public static void RegisterRoutes(RouteCollection routes){    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");    AreaRegistration.RegisterAllAreas();    routes.MaPRoute(        name: "Default",        url: "{controller}/{action}/{id}",        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },        namespaces: new[] { "TestMvcapplication.Controllers" }    );}

3. 在/App_Start/RouteConfig.cs中,檢查routes.MapRoute()中是否顯性指定了默認Controller的namespace。

namespaces: new[] { "TestMvcApplication.Controllers" }

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 西充县| 北海市| 赫章县| 汨罗市| 祥云县| 嘉祥县| 阿坝县| 德清县| 都兰县| 富蕴县| 禄劝| 柘城县| 和顺县| 梁河县| 望奎县| 九寨沟县| 温州市| 荔浦县| 普洱| 江阴市| 滕州市| 东源县| 剑阁县| 时尚| 临猗县| 太谷县| 民乐县| 白银市| 正蓝旗| 涟水县| 扎兰屯市| 台东县| 汉中市| 大新县| 虎林市| 融水| 莆田市| 天柱县| 南和县| 邹平县| 阿拉尔市|