【发布时间】:2013-01-23 09:15:26
【问题描述】:
我有一个全新安装的 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
有什么想法可以在这里做吗?
谢谢
【问题讨论】:
-
哎呀——我的错。忘记覆盖 Index 操作方法。现在可以使用了。
-
考虑回答您自己的问题,然后将其标记为答案。
标签: asp.net-mvc umbraco