Reputation: 163
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...
Upvotes: 5
Views: 5626
Reputation: 40421
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" }
);
Upvotes: 11