AmbiguousActionException: Multiple actions matched NopCommerce 4.00

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi,

We are facing following error when overriding an Action method with same name and same Controller name in nopCommerce 4.00.

This thing is working like charm in nopCommerce 3.90..

The controller name has to be same because we cannot override view page in our plugin due to theming issue (We don't want to provide support for each theme in plugin) and in nopCommerce viewpage, this controller action name is fixed.. Basically OnePageCheckout in our case.. See error below:


An unhandled exception occurred while processing the request.
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:

Nop.Web.Controllers.CheckoutController.Index (Nop.Web)
NopAdvance.Plugin.Widgets.MYPLUGIN.Controllers.CheckoutController.Index (NopAdvance.Plugin.Widgets.MYPLUGIN)
Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions+<>c.<UseNopExceptionHandler>b__1_1(HttpContext context) in ApplicationBuilderExtensions.cs, line 81

Stack Query Cookies Headers
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:

Nop.Web.Controllers.CheckoutController.Index (Nop.Web)
NopAdvance.Plugin.Widgets.MYPLUGIN.Controllers.CheckoutController.Index (NopAdvance.Plugin.Widgets.MYPLUGIN)
Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions+<>c.<UseNopExceptionHandler>b__1_1(HttpContext context) in ApplicationBuilderExtensions.cs
+
                        throw exception;
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware+<Invoke>d__6.MoveNext()
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware+<Invoke>d__6.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__7.MoveNext()

Show raw exception details


Any perfect help would be appreciated.

Thank you,
Atul
5 years ago
Hello,

Anyone?? We do not understand why this is not working.. Can anyone put a light on this. Has anyone did this before?

Thank you in Advance..
5 years ago
Has anyone been able to solve for this issue? All related posts and tutorials I am able to find say to do something like this with your route provider:

public void RegisterRoutes(RouteCollection routes)
        {
            routes.MapLocalizedRoute("HomePagePlugin",
                            "",
                            new { controller = "Home", action = "Index" },
                            new[] { "Nop.Plugin.Misc.MyCustomPlugin.Controllers" });

          
        }


However it appears things have changed since these posts were written, as you now are supposed to invoke the routes like this:

        public void RegisterRoutes(IRouteBuilder routeBuilder)
        {
            routeBuilder.MapRoute("HomePagePlugin", "",
                new { controller = "Home", action = "Index" });
        }

I still get the error mentioned above. I've looked through every page of the limited documentation/tutorials on the site, and none of them address this concern. Can anyone provide an example of this, or point me in the right direction please?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.