Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net

AmbiguousActionException: Multiple actions matched


This message comes in Asp.Net MVC Core applications if no action is found to the target.

For example, if there is no Notes / Index Action, then this message comes up.


The problem also arises when mixing the URL routing between Startup Routes and [Attribute Routes]

Solution: Define the URL routes in Startup.cs either in Asp Core, or prepend an attribute for each IActionResult method in the controller


An unhandled exception occurred while processing the request.

AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:


IWois_Core.Controllers.NotesController.Details (IWois_Core)

IWois_Core.Controllers.NotesController.Create (IWois_Core)

IWois_Core.Controllers.NotesController.Edit (IWois_Core)

IWois_Core.Controllers.NotesController.Delete (IWois_Core)

IWois_Core.Controllers.NotesController.counter_NoteView_erhoehen (IWois_Core)

IWois_Core.Controllers.NotesController.counter_Note_List_erhoehen (IWois_Core)

Microsoft.AspNetCore.Mvc.Internal.ActionSelector.SelectBestCandidate(RouteContext context, IReadOnlyList<ActionDescriptor> candidates)



Attributes routing

Just write in front of the controller action a route attribute in brackets like here


    public class NotesController : Controller




        // GET: /Note Root





        public async Task<IActionResult> Index_All()


            ///-------------< Index_All >-------------


            //< out to view >

            //return View(data_to_View);

            return View("index_all", data_to_View);

            //</ out to view >

            ///-------------</ Index_All >-------------






Problem serverside links


When using links generated by the server (Asp Net Serverside Anchor Links), then before output rendering, the server first checks to see if a controller action hit exists.

<a asp-action="Details" asp-route-id="@item.Note.IDNote">@Html.DisplayFor(modelItem => item.Note.Title)</a>


If routing is correct, this Serverside Link will create a matching URL with Controller / Details / ID.


With the appropriate routing attributes in the server.


        public async Task<IActionResult> Details(long? id)


            if (id == null)


                return NotFound();



If the attribute is not defined but defines an attribute routing in the controller file for the controller and index action,

then an [Attribute] routing has to be written for every detail action

if the detail attribute is not written then a server-side link will be displayed incorrectly


This will create a wrong server-side link

<a href="/Notes?id=3">3 seconds later</a>


Asp core redirect http to https and www. To directly domain host
Asp MVC Core: URL Query Parameters
Asp Core MVC: New Define Startup File, Start Controller View
Asp MVC: HTML links instead of server side links
AmbiguousActionException: Multiple actions matched
Asp.Net Core MVC: Create Alternative URL Routes


Contact for Jobs, Project Requests: