-3

enter image description here

While running the project in visual studio; I am getting the error as in the attached image.

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }   
        //Attendance, Timetable
    );
}

I put the break-point on the opening bracket. But it is not working. This problem happened just 1 hour before. Please tell me solution to solve the problem. Because this project is plans to release soon. By expecting a good solution, Sibin

adiga
  • 34,372
  • 9
  • 61
  • 83
Sibin
  • 1
  • 7
  • What is not working? - that is just the standard default route. –  Sep 21 '17 at 08:35
  • Sir, I put the break-point in the opening bracket " public static void RegisterRoutes(RouteCollection routes) { " , but while running the project, the break point is not working. RouteConfig.cs is not working – Sibin Sep 21 '17 at 09:18
  • Show your `Index()` method in `HomeController` –  Sep 21 '17 at 09:22
  • public ActionResult Index() { return View(); } – Sibin Sep 21 '17 at 09:30
  • Sir, while starting project, first it will move to RouteConfig. I put the break point there. But break point is not working in RouteConfig page – Sibin Sep 21 '17 at 09:38
  • check your Global.asax file. `protected void Application_Start() { RouteConfig.RegisterRoutes(RouteTable.Routes); }` the above code should be there in Global.aspx file. – Mohan Singh Sep 21 '17 at 10:01
  • I just had this problem on an old hobby project of mine I returned to for a bit of maintenance. I renamed the assembly and all the namespaces but didn't remove some of the references from web.config files in subfolders, namely in the element. Once I did that it was resolved. – Rob Gray May 28 '20 at 10:08

1 Answers1

1

Make sure you have a controller named HomeController, an ActionResult named Index and a view for the same.

Also check your Global.asax.cs, It must contain the following code

    protected void Application_Start()
    {
        RegisterRoutes(RouteTable.Routes);
    }
Alsamil Mehboob
  • 384
  • 2
  • 6
  • 24