It has to be something simple that I'm missing, since this is my first try on MVC. Seems nothing works but the default route.
This were my steps:
- Create new solution from an MVC5 template (Which comes with a HomeController and a Controller/Action/Id by default on the RouterConfig.Configuration.
- Add --> Controller named Foo --> Create an ActionResult named Details
- Add a View named Details
- Run the MVC project
- Appears the home page, and I change the url from
localhost:50212
to
localhost:50212/Foo/Details
Result: I get a 404
Is it that the MVC AreaRegistration
does not happen automatically on compile time?
I went to the Global.asax and tried placing on Application_Start
AreaRegistration.RegisterAllAreas();
But that seemed useless. Any Ideas? Is it that VS community 2015 is missing something? Regards
Controllers/FooController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcTest.Controllers
{
public class FooController : Controller
{
// GET: Foo
public ActionResult Details()
{
return View();
}
}
}
Views/Foo/Details.cshtml
@model MyModel
Hello
App_start of the Global.asax
namespace MvcTest
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
AreaRegistration.RegisterAllAreas();
//This up here is something I added manually after its byDefault scaffolding
FilterConfig.Configure(GlobalFilters.Filters);
RouteConfig.Configure(RouteTable.Routes);
}
@Edit, added FooController and Views/Foo/Details
@@Edit: added missing s to Details. Same error.
@@@Edit: sharing the Global.asax