asp.net mvc 2 global.asax.cs 被忽略

发布于 2024-09-12 06:17:32 字数 395 浏览 10 评论 0原文

当我确信我设置正确时,我在调试路由时遇到了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蘑菇王子 2024-09-19 06:17:32

尝试以这篇文章为起点。

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.

初见终念 2024-09-19 06:17:32

好吧,这已被重新启动。事实证明,不知何故,以下行从我的 csproj 文件中删除了:

<Content Include="Web.config" />

我不知道它是如何发生的,也不知道为什么......它很愚蠢并且重新启动,我对此感到非常沮丧,因为我失去了两天的生产力..但

我很高兴它已修复。感谢您的帮助!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文