1

我已经使用 N2 CMS 一段时间了,我刚刚更新为使用 MVC 3 RC,现在我在每个页面上都收到此错误:

当前对控制器类型“HomeController”的操作“索引”的请求在以下操作方法之间是不明确的: System.Web.Mvc.ActionResult Index() on type Project.Web.Controllers.N2Controller 1[[Project.Web.Models.HomePage, Project.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] System.Web.Mvc.ActionResult Index() on type N2.Web.Mvc.ContentController1[[Project.Web.Models.主页,Project.Web,版本=1.0.0.0,文化=中性,PublicKeyToken=null]]

只是为了解释我有一个 HomeController,它继承自 N2Controller<HomePage>,N2Controller<T> 继承自 N2.Web.Mvc.ContentController<T>。

每个控制器、Home、Account 等都没有 Index 方法,因为 ContentController 已经有一个。

这一切都适用于 MVC 2,但对于 MVC 3 RC,它会抛出此错误。

有什么想法吗?我在网上找不到任何东西...

干杯,阿什。

4

1 回答 1

1

这听起来像 N2Controller 有一个Index方法,应该设置为覆盖ContentController中的Index方法。

在控制器上解析操作方法的方式必须在 MVC2 和 3 之间更改,以考虑继承层次结构,从而导致此问题。

于 2011-01-13T11:25:18.120 回答