5

我有一个全新安装的 umbraco 4.11.3 我正在尝试使用 进行简单的控制器测试,但对我来说出了点问题。我创建了一个没有匹配模板的文档类型“演示”。然后基于该文档类型的名为“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

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

谢谢

4

1 回答 1

8

忘记提供覆盖,

    public override ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }
于 2013-01-23T01:15:26.893 回答