Sometime back I came across a very good question on ServerFault and I thought of doing some research to understand how IIS handles Custom Errors setting when all requests are passed through aspnet_isapi.dll.
Here is a brief background:
Scenario 1:
We have a Wildcard mapping configured for aspnet_isapi.dll with “Verify that file exists” unchecked.
We also have Custom Errors configured for 404. We have configured it as a URL and the path is /404/. Remember the path 404 does not exists in wwwroot (or the Web site content folder).
Here’s my observation:
- When you add "Wildcard mapping" for aspnet_isapi.dll with "Verify that file exists" unchecked, all the request actually passes through the .net pipeline
- When you access a fake directory, .net actually looks for all .config files.. i.e. machine.config, root web.config (that's in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) and your Web site root directory to look for a possible HttpHandler that can handle your request
- Since none of the handler's are configured to handle "directory" request, the request falls back on
IISGeneral: GENERAL_STATIC_FILE_HANDLER and fails with 0x80070002 i.e. FILENOTFOUND - Since you have IIS Custom Errors 404 configured as /404/, it looks into the directory c:\inetpub\wwwroot\404\, fails with another
0x80070002 and sends a generic The system cannot find the file specified. error. - When you access a fake main.aspx page, .aspx request is handled in the root web.config file and hence you see a .net specific (The resource cannot be found.) error.
Scenario 2:
We now change the Wildcard mapping configured for aspnet_isapi.dll with “Verify that file exists” as checked.
Here’s what changes:
- Now, when you check "Verify that file exists" for the "Wildcard mapping", the server checks that the requested script exists before mapping an extension to an application
- Hence, the request never passes through the .net pipeline and gives you the error as stated in point 4 above.
Hope this helps,
Vivek Kumbhar
Quote of the day: Philosophy is a battle against the bewitchment of our intelligence by means of language. - Ludwig Wittgenstein