Skip to content

MVC Style Bindings - Multiple actions were found ERROR #131

Open
@freeranger

Description

@freeranger

If I have a controller with two GET actions - e.g /api/get and /api/get/:id, when I add [MvsStyleBinding] to my controller, I get the following error:

An error has occurred.
ExceptionMessage: Multiple actions were found that match the request: 
Get on type MvcStyleBindingProblem.ValuesController
GetById on type MvcStyleBindingProblem.ValuesController
ExceptionType:System.InvalidOperationException
StackTrace:  at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)
   at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)
   at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()

I have a very simple api project here demonstrating the problem:
https://github.com/freeranger/MvcStyleBindingProblem

If I remove the[MvcStyleBinding] then the error goes away but obviously the whole point is to actually use it ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions