【发布时间】:2014-09-25 05:59:57
【问题描述】:
我正在从 Here 学习 Sitecore 中的控制器渲染。
我创建了一个简单的控制器(HelloWorld)和相关视图(Index.schtml)。在 Sitecore Explorer 的渲染部分映射它(使用名称 PageContent)...并在 Sitecore Explorer 的内容部分的主页项中添加渲染项。但是当我浏览它时,它给出了错误。
The controller for path '/' was not found or does not implement IController.
我读过的所有帖子都与 Asp .Net MVC ..但我有与 Sitecore MVC 相关的问题
Sample.html(Sitecore Explorer 渲染部分中的页面内容)
@using Sitecore.Mvc
<html>
<body>
@Html.Sitecore().Placeholder("content")
<p>Today's date is @DateTime.Now.ToShortDateString()</p>
</body>
</html>
只有这条线给出了问题
@Html.Sitecore().Placeholder("content")
如果我删除此行...它可以正常工作并且浏览器上的页面显示日期和时间
索引.html
<p>Hello from Controller -todays Date is @DateTime.Now.ToString()</p>
控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MVC.Controllers
{
public class HelloWorldController : Controller
{
//
// GET: /HellowWorld/
public ActionResult Index()
{
return View();
}
}
}
【问题讨论】:
标签: c# .net controller sitecore sitecore-mvc