Jez
Jez

Reputation: 29993

Why is this Web.Debug.config not working?

I'm trying to disable custom HTTP errors in my debug builds. I have this in Web.config:

<configuration>
  [...]
  <system.webServer>
    [...]
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" subStatusCode="-1" />
      <remove statusCode="403" subStatusCode="-1" />
      <remove statusCode="500" subStatusCode="-1" />
      <error statusCode="403" path="/errors/403" responseMode="ExecuteURL" />
      <error statusCode="404" path="/errors/404" responseMode="ExecuteURL" />
      <error statusCode="500" path="/errors/500" responseMode="ExecuteURL" />
    </httpErrors>
  </system.webServer>
</configuration>

And this in Web.Debug.config:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  [...]
  <system.webServer>
    [...]
    <httpErrors errorMode="Detailed" xdt:Transform="Replace"></httpErrors>
  </system.webServer>
</configuration>

And yet on Debug builds I still get the custom error pages. Should this transform not replace the httpErrors element with one that sets it back to detailed error messages?

Upvotes: 0

Views: 151

Answers (1)

Jez
Jez

Reputation: 29993

I was being an idiot; those transforms don't apply when you're just debugging locally; they only get applied when you're publishing.

Upvotes: 1

Related Questions