问题
IIS 7.5
Windows 7 64-bit
.NET 4.0
I have a .NET 4.0 site in IIS 7.5. The Default Document is set to home.aspx.
If the application pools managed pipeline mode is set to "Classic" http://localhost/mysite displays the following error
Server Error in '/mysite' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /mysite
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
If I go to http://localhost/mysite/home.aspx, the site displays correctly.
If I use "Integrated" as the managed pipeline, the site displays correctly using either path.
I have tried the EnableExtensionlessUrls fix for earlier IIS versions and also to put the default document information directly in the web.config. Neither of these worked for the "Classic" pipeline mode.
Any idea why this is happening?
回答1:
There is a bug introduced with KB980368 (A [sic] update is available that enables certain IIS 7.0 or IIS 7.5 handlers to handle requests whose URLs do not end with a period) which is also rolled into Windows 7/2008R2 Service Pack 1. We discovered this bug when we rolled out this hotfix which is required for WebMatrix web hosting validation.
See my previous question and answer here:
ASP.NET 2.0 and 4.0 seem to treat the root url differently in Forms Authentication
We raised this with MS PSS and whilst they have reproduced the issue they haven't yet yielded a fix for it (the PSS issue has been open since 23/02/11). All that's happened so far is that a new KB article recognising the problem has been issued:
Web services may fail on Microsoft Internet Information Services (IIS) 7.5 and Windows 7 Service Pack 1 with .NET Framework 4.0 due to extensionless URL handlers (KB2520479)
The article suggests two fixes, the first of which is ineffective and the other isn't exactly ideal for us at the moment.
However the problem you're experiencing may not actually be related but I thought I'd share this anyway.
来源:https://stackoverflow.com/questions/5737663/site-not-redirecting-to-default-document-in-classic-pipeline-mode