分区项目建立方法:添加-->区域-->区域名
然后我们发现生成了一个Areas文件夹并且里面有视图控制器和Model,我们再添加一个Home控制器和对应的默认视图,我们看到再Register类文件中有一个路由文
这时候我们运行程序发现
项目中存在两个同命的Home控制器需要指定对应命名空间的控制器,这时候我们就要配置一下,在RouteConfig中添加namespaces:new string[] { "分区demo.Controllers" }
在Areas文件夹中的AdminAreaRegistration类文件中添加namespaces:new string[] { "分区demo.Areas.Admin.Controllers" }指定相应命名空间的控制器
然后我们再次运行,发现不存在冲突