MVC运行报错

Only_You_forver 2010-05-05 11:10:01
报错信息:
The view 'Index' or its master was not found. The following locations were searched:
~/Views/CreateImage/Index.aspx
~/Views/CreateImage/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: The view 'Index' or its master was not found. The following locations were searched:
~/Views/CreateImage/Index.aspx
~/Views/CreateImage/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
Global文件配置信息如下:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "CreateImage", action = "Index", id = UrlParameter.Optional }
);
CreateImageController的Action部分:
public ActionResult Index()
{
return View();
}
页面Form部分:
<% Html.BeginForm("Index", "CreateImage", FormMethod.Post); %>

<%Html.EndForm(); %>
小弟初识net MVC请大家多多指教!!
...全文
331 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ntgjh 2010-05-29
  • 打赏
  • 举报
回复
return View("~/areas/XXXX/views/CreateImage/Index.aspx");
可以解决,但太麻烦了,有没有更好的办法?
wellst 2010-05-09
  • 打赏
  • 举报
回复
MVC是访问Action,但是你的Action return View() 应该有个View(Index.aspx)这样吧
lau_tak_wah 2010-05-08
  • 打赏
  • 举报
回复
action相当于一个方法,不是页面
nbgzc 2010-05-07
  • 打赏
  • 举报
回复
缺少view文件

~/Views/CreateImage/Index.aspx
~/Views/CreateImage/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx

他的寻找次序是这样的。。

你应该搞个 ~/Views/CreateImage/Index.aspx

自己定义的话,要在action里 view("需要的view");
zhujiazhi 2010-05-06
  • 打赏
  • 举报
回复
提示是view没有找到的
/Views/CreateImage/Index.aspx
在这个路径下没有找到这个view的,看看是不是哪个地方写错了
meditatorx 2010-05-06
  • 打赏
  • 举报
回复
应该是没有Index.aspx文件吧
claymore1114 2010-05-06
  • 打赏
  • 举报
回复
没有Index.aspx页面
Only_You_forver 2010-05-06
  • 打赏
  • 举报
回复
额,
MVC是根据Action访问的,Index是一个Action而不是页面。
汗。。。。。。。。。。。。
Only_You_forver 2010-05-05
  • 打赏
  • 举报
回复
CreateImageController的Action里面有Index的啊
xrongzhen 2010-05-05
  • 打赏
  • 举报
回复
不是说了"Index"没发现 看一下Index

13,347

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET技术前瞻
社区管理员
  • .NET技术前瞻社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧