Why won't this MVC Route Work?
asp.net-mvc, asp.net-mvc-routing, c#
Solution
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" }
);
Problem
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...