【问题标题】:Sitecore rendering not found intermittently间歇性找不到 Sitecore 渲染
【发布时间】:2016-06-16 22:14:03
【问题描述】:

我们有一个页面,上面有各种效果图。此页面间歇性加载良好。有一天它会毫无问题地工作,而另一天它会完全停止工作。当它完全停止工作时,问题是

 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);
}

关于如何解决这个问题的任何想法?

【问题讨论】:

  • 你在使用控制器渲染吗?你能告诉我你返回视图的操作代码吗?
  • 是的,使用控制器渲染。稍后我会发布代码。
  • 我更新了代码。
  • 好像找不到渲染图。控制器的名称是什么?如果您没有为您的视图指定路径,它将尝试根据控制器的名称或在共享中找到它。
  • @Ian .. 渲染位于已注册的路径下。所有其他渲染在使用相同控制器的相同渲染中都可以正常工作。

标签: asp.net-mvc sitecore rendering sitecore-mvc


【解决方案1】:

提供渲染的完整路径:

public ActionResult GetComponent()
{
    //code to populate the model
    return View("~/Views/Your_View_Folder/renderingname.cshtml",model);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-30
    • 1970-01-01
    • 2014-08-01
    • 2016-11-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多