asp.net-mvc - Umbraco 4.11.3 - 当前对 Controller 类型的请求不明确

标签 asp.net-mvc umbraco

我全新安装了 umbraco 4.11.3,我正在尝试使用 进行简单的 Controller 测试,但出现了一些问题。我创建了一个文档类型“演示”,但没有匹配的模板。然后,基于该文档类型的名为“Demo”的内容项并更改此配置设置(defaultRenderingEngine --> MVC),我使用下面的代码添加了一个新 Controller 。

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
 using Umbraco.Web.Models;

 namespace FrontEnd.Controllers
 {
    public class DemoController : Umbraco.Web.Mvc.RenderMvcController
   {
    //
    // GET: /Demo/

    public ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }
    public ActionResult Demo(RenderModel model)
    {
        return View(model);
    }
}
}

我收到此错误:

The current request for action 'Index' on controller type 'DemoController' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type FrontEnd.Controllers.DemoController
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type Umbraco.Web.Mvc.RenderMvcController

Exception Details: System.Reflection.AmbiguousMatchException: The current request for action 'Index' on controller type 'DemoController'    
is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type FrontEnd.Controllers.DemoController
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type Umbraco.Web.Mvc.RenderMvcController

关于在这里做什么有什么想法吗?

谢谢

最佳答案

忘记提供覆盖,

    public override ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }

关于asp.net-mvc - Umbraco 4.11.3 - 当前对 Controller 类型的请求不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14369640/

相关文章:

asp.net-mvc - DDay iCal - 添加参加者

asp.net-mvc - 使用 Asp.NET MVC 网站对 Lucene.NET 进行负载平衡

c# - 使用 C# 获取 Umbraco 选项卡

c# - asp.net 的轻量级搜索引擎

razor - Umbraco 5表面 Controller 和部分宏

asp.net-mvc - Ninject 返回对象的特定实例

asp.net-mvc - 如何在html.LabelFor中显示一些文本?

c# - 我无法在 Razor View 中设置断点

c# - Umbraco 7 中的表面 Controller 还是自定义 Controller ?

Umbraco Contour 多步表单 - 根据用户输入决定下一步