我们有一个页面上有各种渲染。此页面间歇性地加载。有一天它会毫无问题地工作,有一天它会完全停止工作。当它完全停止工作时,问题是
Exception: System.InvalidOperationException
Message: The view 'renderingname.cshtml' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/News/renderingname.aspx
~/Views/News/renderingname.ascx
~/Views/Shared/renderingname.aspx
~/Views/Shared/renderingname.ascx
~/Views/News/renderingname.cshtml
~/Views/News/renderingname.vbhtml
~/Views/Shared/renderingname.cshtml
~/Views/Shared/renderingname.vbhtml
路线已在OOTB路线前正确注册。页面上的其他视图永远不会出现与renderingname.cshtml位于同一目录中的此问题。
以下是运行此组件的控制器代码,没有型号代码 -
public ActionResult GetComponent()
{
//code to populate the model
return View("renderingname", model);
}
有关如何解决此问题的任何想法?
答案 0 :(得分:0)
提供渲染的完整路径:
public ActionResult GetComponent()
{
//code to populate the model
return View("~/Views/Your_View_Folder/renderingname.cshtml",model);
}