Reputation: 2126
I working on "Code Camper" sample SPA application. I am running the app on VS 2010 with MVC 4 installed. But I ran into problem with LookupsController.
Here is the error I got:
"exceptionMessage":"Multiple actions were found that match the request: \r\nSystem.Collections.Generic.IEnumerable`1[CodeCamper.Model.Room] GetRooms() on type
CodeCamper.Controllers.LookupsController\r\nSystem.Collections.Generic.IEnumerable`1[CodeC
amper.Model.TimeSlot] GetTimeSlots() on type
CodeCamper.Controllers.LookupsController","exceptionType":"System.InvalidOperationException
","stackTrace":" at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectActio
n(HttpControllerContext controllerContext)\r\n at
System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext
controllerContext)\r\n at
System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext,
CancellationToken cancellationToken)\r\n at
System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage
request, CancellationToken cancellationToken)\r\n at
System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)"
Upvotes: 2
Views: 2756
Reputation: 2126
I found the answer!
When you create a web api project, by default there is this line of code in global.asax.cs
WebApiConfig.Register(GlobalConfiguration.Configuration);
I removed it (as I saw from source code of codecamper) and now there is no problem any more! but I dont know why exatly
Upvotes: 3