2013-01-16 28 views
5

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

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 

在哪里可以在这里做任何想法?

感谢

+0

哎呀 - 我的坏。忘了重写Index操作方法。现在工作。 – MikeW

+1

考虑回答你自己的问题,然后将其标记为答案。 –

回答

8

忘了提供覆盖,

public override ActionResult Index(RenderModel model) 
    { 
     return base.Index(model); 
    } 
相关问题