Umbraco 4.11.3 - 控制器类型的当前请求不明确

时间:2013-01-16 23:16:19

标签: asp.net-mvc umbraco

我有一个全新安装的umbraco 4.11.3我正在尝试用一个简单的控制器测试,但是有些事情对我来说是错误的。我创建了一个没有匹配模板的文档类型“Demo”。然后基于该Document类型调用名为“Demo”的内容项并更改此配置设置(defaultRenderingEngine - > MVC)我添加了一个带有以下代码的新控制器。

 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

关于在这里做什么的任何想法?

由于

1 个答案:

答案 0 :(得分:8)

忘记提供覆盖,

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