I had previously asked a question about a 404 error being thrown but thanks to help from folks attempting to help me debug, I now have a more specific question to ask.
I see the following error when I load any view that invokes @Html.Partial:
This localhost page can’t be found
In visual studio, I see return View() being hit.
Sample method from HomeController:
[Route("")]
public ActionResult Welcome()
{
return View();
}
I'm using Microsoft.AspNet.MVC version 5.2.7 in case it's relevant.
Image of browser error:
RouteConfig:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapMvcAttributeRoutes();
}
}
My directory:
Welcome.cshtml:
@using Newtonsoft.Json
@{
Layout = null;
}
<!doctype html>
<html class="no-js" lang="">
<head>
<title>Test</title>
@Html.Partial("_HeadPartial")
</head>
<body>
<p></p>
</body>
</html>
_HeadPartial:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Any kind of partial reference:
@Html.Partial("_AnalyticsPartial")
Gives me the above 404 error; removing the reference allows rendering to succeed. My partials can be empty and still result in a 404.
Why is @Html.Partial causing this?

