I have the following routes defined in my RouteConfig class:
routes.MapRoute(
name: "DefaultMessage",
url: "API/{action}",
defaults: new { action = "MessageGateway" }
);
routes.MapRoute(
name: "DefaultNoParms",
url: "{controller}/{action}",
defaults: new { controller = "API", action = "Login" }
);
When I test this on my localhost with just localhost:65133/ as the address I am routed to the Login ActionResult on the APIController, but when I try localhost:65133/API I get the following error:
The matched route does not include a 'controller' route value, which is required
Can anyone tell me what is wrong? The ActionResult MessageGateway does exist...
Seems like the error is self-explanatory - you need to tell it what controller to go to.
routes.MapRoute(
name: "DefaultMessage",
url: "API/{action}",
defaults: new { controller = "API", action = "MessageGateway" }
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With