Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is IIS Express using <system.web> and not <system.webServer>?

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?

like image 478
Scott Coates Avatar asked Mar 03 '12 02:03

Scott Coates


1 Answers

Well I tried a few different things:

  • Changed existingResponse to PassThrough as noted here

    <httpErrors errorMode="Custom" existingResponse="Replace">

Nope!

  • Set TrySkipIisCustomErrors = false as noted in comments here

Notta!

I ended up getting it to work by simply changing the existingResponse to Replace.

  • Who knew!

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

like image 133
Scott Coates Avatar answered Sep 24 '22 06:09

Scott Coates