问题
We are experiencing a problem with an application we recently migrated from IIS 6 .net 2.0 to IIS 7.5 .net 4.0 (ASP.Net Web Forms)
The code performs custom rewriting in the global.asax Application_BeginRequest event and uses the HttpContext.Current.RewritePath() method to do the re-writing.
When a bad request (a page which does not exist) with an extension comes in like /kentest/test.blah things are handled properly - IIS properly passes in the custom error page which we re-direct to.
When a bad request comes in without a file extension like /kentest/test then IIS does not properly pass the custom error page. We get caught in a loop rewriting the same /kentest/test over and over until IIS throws a recursion 500 exception.
Any ideas how to solve this and get requests without extensions working?
Others seem to have encountered this issue as this blog post mentions but no solution is provided.
Update We Solved This Issue
We needed to add the following to the web.config in the handlers section:
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
回答1:
We needed to add the following to the web.config in the handlers section:
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
来源:https://stackoverflow.com/questions/11633611/iis-7-5-a-breaking-change-in-extensionless-uris-handling-after-windows-server