2013-01-16 32 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); 
    } 
相關問題