views:

950

answers:

2

I currently have the following routines in my Global.asax.cs file:

public static void RegisterRoutes(RouteCollection routes)
{
 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
 routes.MapRoute(
  "Default",                                          
  "{controller}/{action}/{id}",                       
  new { controller = "Arrangement", action = "Index", id = "" }
 );
}

protected void Application_Start()
{
 RegisterRoutes(RouteTable.Routes);
 // Debugs the routes with Phil Haacks routing debugger (link below)
 RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}

Routing debugger...

When I hit F5, the application fires up and unless I have a view named Index.aspx in the ~/Views/Home/ folder, I get the "View missing" error message, although I have re-defined the default route and removed the HomeController. I would expect to get the routing debugger, and if not that at least a request for ~/Views/Arrangement/Index.aspx.
A breakpoint on RegisterRoutes(Routetable.Routes); is never hit when debugging.

I have tried building, rebuilding, restarting VS, cleaning, rebuilding again etc, but nothing seems to work. Why doesn't the application run the current version of the code?

+3  A: 

I believe you have to shutdown/stop the local debugging server in order for the Application_Start() event to fire again... you should be able to right click on it in the system tray and choose "Stop".

John Rasch
I did. And even today - after shutting down the computer overnight - the problem persists...
Tomas Lycken
Brilliant. (+1)
Pablo Santa Cruz
+2  A: 

I found the problem:

This MVC application was part of a larger solution, in which I had at one point set another project to build for an x86 environment (I'm running x64). When I did that, apparently all other projects - even those added later - were set not to build on Ctrl+Shift+B, and I suppose that's why the debugger didn't hit my breakpoint.

Solution:

Go into the solution build properties (right-click Solution, select properties, and select Build on the menu on the left), and put a check in the Build checkbox next to the project name in the list.

Tomas Lycken