Was using Cassini but switched to IIS Express. My initial thought was that I could remove all <system.web>
except things like:
<authentication mode="Forms">
<forms loginUrl="/" />
</authentication>
My previous customErrors
were setup like so:
<customErrors mode="On" defaultRedirect="/ServerError">
<error statusCode="404" redirect="/NotFound" />
</customErrors>
I removed this customErrors
element when I switched to IISExpress. Now 404's no longer redirect to my nice "NotFound" page.
The AppPool used for my site is Clr4IntegratedAppPool
which lets me know it's not using Classic.
Why is IISExpress so reliant on system.web
whereas IIS 7.5 uses system.webServer
?
Well I tried a few different things:
Changed existingResponse
to PassThrough
as noted here
<httpErrors errorMode="Custom" existingResponse="Replace">
Nope!
TrySkipIisCustomErrors
= false
as noted in comments here
Notta!
I ended up getting it to work by simply changing the existingResponse
to Replace
.
This is how system.webServer
looks now:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/NotFound" responseMode="ExecuteURL" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" path="/ServerError" responseMode="ExecuteURL" />
</httpErrors>
Why this solution doesn't make any sense
Replace – This value make custom error module to always replace the error information with text generated by custom error module. If existingResponse is set to “Replace”, errors/exceptions generated by Asp.Net/WCF are replaced by IIS7 errors.
http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With