asp.net mvc 2 global.asax.cs 被忽略
当我确信我设置正确时,我在调试路由时遇到了 404 错误的原因。我做了更改,重建,仍然是404,我对路线做了各种疯狂的事情,但总是404。
然后在我的沮丧中,我删除了global.asax中的所有路由,保存重建并运行。我仍然遇到 404...
但网站的其余部分没有损坏!怎么会这样呢?我认为你必须路由路径,否则什么都不起作用......即使我的自定义路由仍然有效。我重建并重新保存了 web.config。我什至停止了网站,甚至停止了应用程序池,甚至停止了 IIS,然后重新启动了所有内容...
我所有的路由似乎仍然在那里!
我什至抛出了除以零的错误,甚至强制在 Application_Start 上抛出异常...这些都没有改变任何内容...
到底发生了什么?我的路线是否缓存在某处?在哪里?!
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?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试以这篇文章为起点。
http://haacked.com/archive/2008/03/ 13/url-routing-debugger.aspx
我有一个类似的问题,在我的脑海里我以为我正在考虑,但事实证明并非如此。这样,您将看到哪些路由正在加载,哪些路由被忽略,以及最终您正在匹配的路由。
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.
好吧,这已被重新启动。事实证明,不知何故,以下行从我的 csproj 文件中删除了:
我不知道它是如何发生的,也不知道为什么......它很愚蠢并且重新启动,我对此感到非常沮丧,因为我失去了两天的生产力..但
我很高兴它已修复。感谢您的帮助!
okay this was retarted. it turns out that SOMEHOW, the following line was removed from my csproj file:
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!