ItGo.me Focus on IT Recommend

Home > asp.net mvc - N2 CMS and MVC 3 RC causes "The current request for action 'Index' on controller...is ambiguous...'

asp.net mvc - N2 CMS and MVC 3 RC causes "The current request for action 'Index' on controller...is ambiguous...'

2021腾讯云限时秒杀,爆款1核2G云服务器298元/3年!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1062

2021阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址https://www.aliyun.com/minisite/goods

I've used N2 CMS for a while now, I've just updated to use MVC 3 RC and I'm now recieving this error on every page:

The current request for action 'index' on controller type 'HomeController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult Index() on type Project.Web.Controllers.N2Controller1[[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.HomePage, Project.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]

Just to explain I have a HomeController, that inherits from N2Controller< HomePage >, N2Controller< T > inherits from N2.Web.Mvc.ContentController< T >.

Each controller, Home, Account etc don't have Index methods because the ContentController already has one.

This all worked absolutely fine with MVC 2, but with MVC 3 RC it's throwing this error.

Any ideas anyone? I can't find anything online...

Recommend:asp.net mvc - The current request for action ... on controller type ... is ambiguous between the following action methods

or action 'New' on controller type 'PersonController' is ambiguous between the following action method System.Web.Mvc.ActionResult New() on type PersonMVC.Controllers.PersonController System.Web.Mvc.ActionResult New(PersonMVC.Models.Person)

Cheers, Ash.

asp.net-mvc content-management-system asp.net-mvc-3 n2 n2cms
asked Jan 13 '11 at 9:16 Ash 416 1 8 18

 | 

1 Answers
1

---Accepted---Accepted---Accepted---

This sounds like N2Controller has an Index method which should be set to override the Index method in ContentController.

The way an action method is resolved on a controller must have changed between MVC2 and 3 to take into account the inheritance hierarchy, causing this problem.


answered Jan 13 '11 at 11:25 spmason 3,313 2 16 18      I was overriding the Index method, but I removed this and it worked....I didn't mention I was running this in the Azure dev fabric, Razor took an age to get working on Azure too! –  Ash Jan 14 '11 at 12:11

 | 

Recommend:content management system - Building a CMS in ASP.NET MVC

I ask is, I'm making a data-driven website for a client, and I've already spent a significant amount of time building it from the ground-up in MVC, but now the client wants content management facilities. Basically they want to be able to ad

------splitte line----------------------------