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

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

Asp.netMVC4新項(xiàng)目中創(chuàng)建area的后續(xù)操作

2019-11-14 14:34:44
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

asp.net MVC 4新項(xiàng)目中創(chuàng)建area后,往往HomeController與area的HomeController路由發(fā)生混淆,需要手工設(shè)置一些地方避免mvc無(wú)法識(shí)別默認(rèn)路由的狀況。

無(wú)廢話具體步驟:

1. 檢查早Global.asax和/App_Start/RouteConfig.cs中是否已經(jīng)自動(dòng)添加了AreaRegistration.RegisterAllAreas();如不存在,進(jìn)入第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()中是否顯性指定了默認(rèn)Controller的namespace。

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

 


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 青铜峡市| 吕梁市| 社会| 屏南县| 龙南县| 宜宾市| 米林县| 改则县| 合阳县| 樟树市| 银川市| 昌邑市| 宜兰市| 岢岚县| 北安市| 铜山县| 潞西市| 东乡| 诸暨市| 黄浦区| 嵩明县| 白朗县| 徐州市| 昆明市| 郧西县| 中阳县| 全椒县| 噶尔县| 北安市| 方城县| 九龙坡区| 泊头市| 濮阳县| 塔城市| 平潭县| 盐亭县| 磐安县| 阳城县| 巴林左旗| 崇仁县| 同德县|