我正在从这里学习Sitecore中的Controller渲染.
我创建了一个简单的控制器(HelloWorld)和相关视图(Index.schtml).在Sitecore Explorer的渲染部分中映射它(使用Name PageContent)并在Sitecore Explorer的内容部分中的Home Item中添加渲染项目.但是当我浏览它时,它会给出错误.
The controller for path '/' was not found or does not implement IController.
Run Code Online (Sandbox Code Playgroud)
我读过的所有帖子都与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>
Run Code Online (Sandbox Code Playgroud)
只有这条线给出了问题
@Html.Sitecore().Placeholder("content")
Run Code Online (Sandbox Code Playgroud)
如果我删除此行...它工作正常,浏览器上的页面显示日期和时间
的index.html
<p>Hello from Controller -todays Date is @DateTime.Now.ToString()</p>
Run Code Online (Sandbox Code Playgroud)
调节器
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();
} …Run Code Online (Sandbox Code Playgroud)