views:

163

answers:

2

I was having trouble debugging why a route was throwing a 404 when I was positive I set it up correctly. I made changes, rebuilt, still 404, I did all kinds of crazy stuff to the route but always 404.

then in my frustration I just deleted ALL the routing in global.asax, saved rebuilt and ran. I still got 404...

but the rest of the site didn't break!! how can this be? I thought you had to route paths or nothing would work... even my custom routing still worked. I rebuilt, resaved web.config. I even stopped the website, and even the application pool and even IIS ENIIRELY, then restarted evertyhing...

all my routing still seems to be there!

I even threw a divide by zero and even FORCED an exception to be thrown on Application_Start... none of it changed anything...

what in the holy hell is going on? are my routes being cached somewhere? WHERE?!

+1  A: 

Try this post as a start point.

http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

I had a similar issue that in my head I thought I was accounting for, but it turned out not to be the case. With this, you would see which routes are being loaded, which are being ignored, and ultimately, which route you are matching.

Jonathan Bates
unfortunately this isn't going to work because in order to register it I have to add code to the global.asax file which is being ignored. I added it to my bin folder and added the code as the instructions said, but nothing changed...something has to be setup wrong here but I don't know what, it makes no sense!
Josh
Is it possible that you aren't getting successful compilation/builds, and the site is using the last good build, which doesn't have the changes you are making?
Jonathan Bates
but it is building, I did a rebuild on both the solution AND the website, and I even broken the build on purpose, and when I did it wouldn't build, then when I fixed it would rebuild.I feel like I'm in the twilight zone...
Josh
okay wait!!!!! I think I got it! I think you are right! you see I would rebuild and rebuild and it would always say build successfull... but then I deleted the dll that is compiled by the site and rebuild. now it says it can't load the type MvcApplication... shouldn't it have rebuild that dll? I think my project is screwed... how do I repair this thing? how did this even happen?!
Josh
A: 

okay this was retarted. it turns out that SOMEHOW, the following line was removed from my csproj file:

<Content Include="Web.config" />

I don't know how it happened or why.. it's dumb and retarted and I'm completely upset that I lost two days of productivity because of it...

but I'm glad it's fixed. thanks for your help!

Josh