View Error Screenshot 我正在进行练习项目,似乎无法使用体验编辑器向占位符添加渲染。该网站提供了一个javascript错误(尽管是一个非常模糊的错误),日志中出现以下错误:
嵌套异常
Exception: Sitecore.Mvc.Diagnostics.ExceptionWrapper
Message: The controller for path '/' was not found or does not implement IContro
ller.
Source: System.Web.Mvc
at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestConte
xt requestContext, Type controllerType)
at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext re
questContext, String controllerName)
at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(Reques
tContext requestContext, String controllerName)
我到处搜寻没有解决方案。还有其他人遇到过这个问题吗?
修改
模型:
public class FeaturedEvents
{
public FeaturedEvents()
{
}
public HtmlString Heading { get; set; }
public HtmlString Intro { get; set; }
public HtmlString EventImage { get; set; }
}
控制器:
public class FeaturedEventController : Controller
{
public ActionResult Index()
{
return View(CreateModel());
}
private static FeaturedEvents CreateModel()
{
var item = RenderingContext.Current.Rendering.Item;
var FeaturedEvent = new FeaturedEvents()
{
Heading = new HtmlString(FieldRenderer.Render(item, "ContentHeading")),
EventImage = new HtmlString(FieldRenderer.Render(item, "Event Image", "mw=400")),
Intro = new HtmlString(FieldRenderer.Render(item, "ContentIntro"))
};
return FeaturedEvent;
}
}
路线
我正在使用默认路线。我没有被要求改变它。
我已经创建了一个控制器渲染并链接了占位符。但是,只要我在体验编辑器中选择占位符的渲染,它就会给我"发生错误"弹出对话框。
微量 ' /'中的服务器错误应用
路径控制器' /'未找到或未实现IController。
描述:发生了未处理的异常。
异常详细信息:Sitecore.Mvc.Diagnostics.ExceptionWrapper:路径控制器' /'未找到或未实现IController。
来源错误:
Line 84: <div class="container">
Line 85: <div class="row">
Line 86: @Html.Sitecore().Placeholder("FeaturedEvent")
Line 87:
Line 88:
源文件:c:\ inetpub \ wwwroot \ ssd.tac.local \ Website \ Views \ TAC \ Events \ HomeContent.cshtml行:86
堆栈追踪:
[ExceptionWrapper: The controller for path '/' was not found or does not implement IController.]
[ControllerCreationException: Could not create controller: 'FeaturedEvent'.
The context item is: '/sitecore/content/Events/Home'.
The current route url is: '{*pathInfo}'. This is the default Sitecore route which is set up in the 'InitializeRoutes' processor of the 'initialize' pipeline. ]
Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) +172
Sitecore.Mvc.Controllers.ControllerRunner.GetController() +23
Sitecore.Mvc.Controllers.ControllerRunner.Execute() +43
Sitecore.Mvc.Presentation.ControllerRenderer.Render(TextWriter writer) +134
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +30
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +75
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args) +184
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName) +259
ASP._Page_Views_TAC_Events_HomeContent_cshtml.Execute() in c:\inetpub\wwwroot\ssd.tac.local\Website\Views\TAC\Events\HomeContent.cshtml:86
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +137
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +343
[InvalidOperationException: Error while rendering view: '/Views/TAC/Events/HomeContent.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
]
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +826
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +30
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +75
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args) +184
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName) +259
ASP._Page_Views_TAC_Events_One_Column_cshtml.Execute() in c:\inetpub\wwwroot\ssd.tac.local\Website\Views\TAC\Events\One-Column.cshtml:8
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +137
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +343
[InvalidOperationException: Error while rendering view: '/Views/TAC/Events/One-Column.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
]
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +826
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +30
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +75
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args) +184
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName) +259
ASP._Page_Views_TAC_Events_Events_cshtml.Execute() in c:\inetpub\wwwroot\ssd.tac.local\Website\Views\TAC\Events\Events.cshtml:93
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +137
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +343
[InvalidOperationException: Error while rendering view: '/Views/TAC/Events/Events.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
]
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +826
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +30
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +75
(Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +193
Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext viewContext, TextWriter writer) +302
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +90
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +37
&#13;