Troubleshooting the addition of MVC to an ASP.NET WebForms application

I have an ASP.NET WebForms application that I'm trying to switch to MVC for new development. I'm generally following this tutorial plus Google and Stack Overflow. The setup has been "easy", but for some reason I can't seem to get the first MVC controller/view to appear.

My first thought was that I had a problem with the routing, so I installed this nifty routing debugger. I got this to work, and toyed with my routing settings a bit. Eventually I went nuclear and set the following as my entire routing scheme:

  new { controller = "Home", action = "Index", id = "" }

RoutingDebug suggests that routing is indeed working: when I navigate to "/appname/foo" (where "/appname" is my project's virtual path; I'm using the ASP.NET development server at the moment), I get a "True" result for my (first) catchall route, and Home/Index for my controller/action.

However, when I turn off RoutingDebug, I don't get the Home/Index view; instead I get a 404. Additionally, any time I navigate to a legacy .aspx page (either with or without RoutingDebug active) I get the content from the legacy page (I expect to get the view since the route captures every URL).

Thus, it looks to me like, while routing is working, the actual "MVC parts" are not being activated properly. I believe I followed the tutorial correctly so I'm at a loss to explain what's going wrong. How can I determine what the problem is? What things should I be checking?


I know this doesn't directly answer your question but have you tried to turn the switch around? Create a brand new MVC Application and import all your existing files. We did that with our migration and we found it much simpler than trying to thread MVC into an existing WebForms app.

Need Your Help

Simple Databinding Problem data-binding eval declarative

I have a page, which has a public property of type myCustomWebProfile.

KeyEventArgs not responding to pressing escape button

c# keyboard-events keyeventargs

I have a WinForm application in which i whish to use the escape button to close a control. I have created an event on KeyPress and this works when i use any other key than Escape.