Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous match routes #62

Open
JohanLarsson opened this issue Jan 19, 2019 · 0 comments
Open

Ambiguous match routes #62

JohanLarsson opened this issue Jan 19, 2019 · 0 comments

Comments

@JohanLarsson
Copy link
Collaborator

JohanLarsson commented Jan 19, 2019

namespace AspBox
{
    using System.Collections.Generic;
    using Microsoft.AspNetCore.Mvc;

    [Route("api/values")]
    [Route("api/values/{id}")]
    [ApiController]
    public class ValuesController : ControllerBase
    {
        // GET api/values
        [HttpGet]
        public ActionResult<IEnumerable<string>> Get()
        {
            return new string[] { "value1", "value2" };
        }

        [HttpGet]
        public ActionResult<string> Get(int id)
        {
            return $"'{id}'";
        }
    }
}
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:
 
 AspBox.ValuesController.Get (AspBox)
 AspBox.ValuesController.Get (AspBox)
Microsoft.AspNetCore.Mvc.Internal.ActionSelector.SelectBestCandidate(RouteContext context, IReadOnlyList<ActionDescriptor> candidates)
Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler.RouteAsync(RouteContext context)
Microsoft.AspNetCore.Routing.Tree.TreeRouter.RouteAsync(RouteContext context)
Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant