I'am facing a weird problem with a mvc project (visual studio premium 2013). Whenever I make even the smallest change to a .cshtml view, I always receive a "Server Error in '/' Application The resource cannot be found." I must clean and rebuild my project several times for it to work. But if, after a change (just a simple modification in the .cshtml view ), I put a break point somewhere in the code being executed in the controller when this view is requested by the browser, then every thing works fine, no error and the change is immediately reflected in the browser. Being new to mvc (but not to .net asp.net, i am coming from web forms), I'm trying to understand some key concepts.
I have changed my default routing to:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Index", action = "GetIndexPage", id = UrlParameter.Optional }
);
You can see that I have changed the default names: Home --> Index, action Index --> GetIndexPage
I have also updated the code in my controller accordingly:
IndexController
GetIndexPage()
return View(...)
As I said this works fine the first time, or after several clean and build solution or a break point inside GetIndexPage()
Using the integrated debugger of the Chrome Browser I saw this exception:
HttpException: A public action method "Index" was not found on controller IndexController
at System....Controller.HandelUnknownAction(string actionname)
Why is it looking for an action Index while in my default settings I have specifically mentionned "GetIndexPage"?