After upgrading from MVC4 with AttributeRouting.net to MVC5 with MVC5's attribute routing, I can't seem to get the default route working so that http://server
defaults to http://server/home/index
. Browsing directly to /home/
or /home/index
works fine.
For route config, I have this:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
The HomeController declaration looks like this:
// Controller
[RoutePrefix("home")]
public class HomeController : MvcControllerBase
....
// Action
[HttpGet, Route, Route("index")]
public ActionResult Index()
{
.....
I'm not sure where else to check. I've commented out everything in Global and disabled all WebActivator-activated items.
And ideas? The response is 404 with no exception being thrown.