国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 高雄市| 临潭县| 贡觉县| 宜州市| 崇州市| 洪雅县| 旺苍县| 陆河县| 锡林郭勒盟| 右玉县| 屏东县| 蕉岭县| 额敏县| 镇巴县| 元江| 牡丹江市| 海宁市| 浦县| 新竹县| 新野县| 乌拉特前旗| 张家界市| 雷山县| 青冈县| 新龙县| 宜良县| 黔西| 固原市| 淮南市| 长汀县| 来安县| 赣州市| 明星| 凤城市| 双江| 湖州市| 即墨市| 从江县| 海门市| 萨嘎县| 江川县|