I am getting the following error when debugging my header links.
I have tried recreating my Index.cshtml (Empty and with Razor/HTML) and my ServicesController. If I browse to Services/Index explicitly then the page loads up correctly.
IE: localhost:58069/Services/ does not work but localhost:58069/Services/Index does
My other controllers are working correctly using the same structure and ActionLink helper.
Not working code:
public class ServicesController : Controller
{
// GET: Services
public ActionResult Index()
{
return View();
}
}
Action Link HTML Helper for Services/Index
<li>@Html.ActionLink("Services", "Index", "Services")</li>
Working Code
public class HomeController : Controller
{
// GET: Home/Index
public ActionResult Index()
{
return View();
}
}
Working Helper
<li>@Html.ActionLink("Welcome", "Index", "Home")</li>
Route Config
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 }
);
}
Tried the following SO solutions: