本文介绍了路由不适用于在Mono上运行的ASP.NET MVC4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mono 3.2.8上运行ASP.NET MVC4应用程序。当控制器动作返回字符串时,

例如:

公共字符串索引()

{

return MVC4页面......;

}



浏览器呈现OK,

但是当控制器动作时返回View(),例如:



public ActionResult Index()

{

return View() ;

}



错误信息如下:



系统.InvalidOperationException

未找到视图'Index'或其主节点或视图引擎不支持搜索的位置。搜索了以下位置:

~ / Views / Home / Index.aspx

~ / Views / Home / Index.ascx

~ /观看/分享/ Index.aspx

~ / Views / Shared / Index.ascx

~ / Views / Home / Index.cshtml

~ /Views/Home/Index.vbhtml

~ / Views / Shared / Index.cshtml

~ / Views / Shared / Index.vbhtml





但是,〜/ Views / Home / Index.cshtml确实存在。





如何解决问题?

Run an ASP.NET MVC4 application on Mono 3.2.8. When the controller action returns string,
for example:
public string Index()
{
return "MVC4 Page...";
}

the browser renders OK,
but when the controller action returns View(), for example:

public ActionResult Index()
{
return View();
}

The error messages are as follows:

System.InvalidOperationException
The view 'Index'or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml


However, ~/Views/Home/Index.cshtml does exist.


How do I solve the problem?

推荐答案



这篇关于路由不适用于在Mono上运行的ASP.NET MVC4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 01:01