asp.net-core-routing

How do I resolve the issue the request matched multiple endpoints in .Net Core Web Api

寵の児 提交于 2020-03-19 06:01:38
问题 I notice that there are a bunch of similar questions out there about this topic. I'm getting this error when calling any of the methods below. Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. I can't however sort out what is best practice in resolving the issue. So far I haven't set up any specific routing middleware. // api/menus/{menuId}/menuitems [HttpGet("{menuId}/menuitems")] public IActionResult GetAllMenuItemsByMenuId(int menuId) {

Endpoint Routing .net core 3-Multiple Areas

流过昼夜 提交于 2020-01-15 03:41:29
问题 I am trying to migrate from .net core 2.2 routing to endpoint routing in asp.net core 3 with following route in startup My .net core 2.2 route were routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "AppArea", template: "{area:exists}/{controller=Home}/{did?}/{action=Index}/{id?}"); .net core 3 route app.UseEndpoints(routes => { routes.MapControllerRoute( name:"default", pattern:"{controller=Home}/{action=Index}/{id?}"); routes

How to configure routing in ASP.NET CORE 3.0 to use overload [HttpGet] method with [FromQuery] parameters?

China☆狼群 提交于 2020-01-05 08:26:25
问题 Sorry about the title, I'm not good at them, let me know if you know any better title to describe the content of the question. So I have 2 methods, the first one is to get all the list items, and the second is to get all the list items too, however, there is a query parameter on the second method, that I use to filter, and the second method also returns a different object than the first method. Since I have 2 Http get methods that go to the same route, when I call one of the methods I get: