视图确实是存在的,路由也配好了,将视图文件Copy到项目根目录下的Views文件夹内可以访问,但是在Areas内的Views文件夹内却找不到视图报错:“
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Main/Index.aspx
~/Views/Main/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Main/Index.cshtml
~/Views/Main/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
”
--------------求大神呀,纠结半天了;初次使用mvc3呀。。
路由 配置 命名空间,访问加上域名,地址加上域名
问题解决了,原来是访问时自己没加Areas下的主目录名,太坑了,搞了半天一直以为是路由配置问题。
@ChinaKingKong: 什么?怎么解决的
就在刚刚我也遇到了,非得在action上添加视图才认识.......
请问 怎么 添加呢
return View("Index"); 这样 还是一样报错。
@湖南金刚: 在Action上右键 添加视图,这样添加的视图才会被Action找到,直接Copy的好像Action无法找到