简体   繁体   English

如何防止.net 4在IIS6上处理404

[英]How to prevent .net 4 handling 404 on IIS6

I have what seems to be the exact opposite of everyone else's problem! 我似乎与其他所有人的问题完全相反! I am hosting a .Net4 site on IIS6, and while I want IIS to handle 404 errors (where I can configure it to send the error to an aspx page), it seems like .Net4 gets in the way by issuing a 302 redirect for the default page (which doesn't exist either) before I can get on with handling the 404 properly. 我在主持一个IIS6网站.NET4,而我希望IIS来处理404错误(在那里我可以配置它的错误发送到一个aspx页面),它看起来像.NET4通过发行302重定向在碍事默认页面(也不存在),然后我才能正确处理404。

Basically, if I goto http://mysite/testProduct , .net4 issues a 302 for http://mysite/testProduct/default.aspx , which then goes on and gets handled by my error handling setup in IIS6 which is to redirect 404s to /404.aspx , which detects the product name, looks up an ID and does a Server.Transfer. 基本上,如果我转到http://mysite/testProduct.net4发出302http://mysite/testProduct/default.aspx ,然后继续,并得到通过我的错误在IIS6处理设置这是重新处理404 /404.aspx ,它检测产品名称,查找ID并执行Server.Transfer。

How can I stop .Net getting in the way? 我如何才能阻止.Net的出现? It's doubling the overhead of a page request, and will cause my products to get indexed with /default.aspx after them which I do not want. 这使页面请求的开销增加了一倍,并且会导致我的产品在我不需要的后面加上/default.aspx进行索引。

AHA, Ben AHA,本

EDIT: if I turn off CustomErrors in the web.config, .Net is still handling the error and not letting it pass to IIS at all - I see a 404 error page that is generated by .Net . 编辑:如果我在web.config中关闭CustomErrors,.Net仍在处理该错误,并且完全不让它传递给IIS-我看到了.Net生成的404错误页面。 So I get a 302 then a 404 ...! 所以我得到302然后是404 ...!

最终发现了问题-这是针对nopCommerce的实现的,该实现随即提供了UrlReWriter的安装-正是该组件导致了上述行为...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM