I am upgrading an asp.net MVC4 application to MVC5 using the instructions here: https://learn.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
I've done this on other projects in the past without issue but for some reason this one is throwing this error: Server Error in '/[My]' Application. This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.
The standard advice for dealing with this error doesn't apply since (a) this code worked before attempting the upgrade and (b) I'm not attempting to return JSON.
I reduced my default controller to something as trivial as I could make it:
HomeController.cs
public class HomeController : Controller
{
public ActionResult Estimated()
{
return View();
}
}
Views/Home/Index.cshtml
@{
ViewBag.Title = "This is a test";
}
<H1>@ViewBag.Title</H1>
I also removed everything but the bare bones from _layout.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@ViewBag.Title</title>
</head>
<body>
@RenderBody()
</body>
</html>
And reduced my MvcApplication to just the Application_Start function:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
I can verify in the debugger that the Index is being called in the controller and can step through that to the point where it returns.
I cannot put a breakpoint on any line of index.cshtml (normally I would be able to break on line 2 or 5), the debugger fails to bind the breakpoint with the error "No symbols have been loaded for the document".
I've been through the upgrade document multiple times and don't see anything that I've missed.
Since these same instructions have worked on other applications in the past and the controller/view work before the upgrade (both the real ones and the trivial ones) I can think of two possibilities:
- I messed up some step in the very detailed and multi-step manual update instructions (this would be my primary hypothesis, but I not only did this twice independently but went over the code multiple times).
- There is something else about this old and complicated application that is inducing this behavior. I can't (obviously) create a minimal repro case for this case, so that would require that someone else has encountered this before and come up with a solution.
Do either the error that's being thrown or the failure to bind the breakpoint on the razor page give a clue as to what I've missed or what might be unusual about this application?