Failed to handle http error on azure

Solution to my problem: Added:

<httpErrors errorMode="Custom">
 <remove statusCode="403" subStatusCode="-1" />
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" path="/404.html" responseMode="Redirect"/>
  <error statusCode="403" path="/403.html" responseMode="Redirect"/>
  <error statusCode="500" path="/500.html" responseMode="Redirect"/>



<customErrors mode="On">
      <error statusCode="403" redirect="~/403.html" />
      <error statusCode="404" redirect="~/404.html" />
      <error statusCode="500" redirect="~/500.html" />


I applied httpErrors in Web.config for my project, then when I test on localhost it is ok. However, when I post on azure image, it cannot handle http 500 and 403 errors. For example:

I tried url: Localhost response: Ok, I get 500 pages or 403 Response to azure: "The page cannot be displayed because an internal server error has occurred."

My web.config:

<httpErrors  errorMode="Custom">
              <error statusCode="403" subStatusCode="14" path="403.html" responseMode="Redirect"/>
              <error statusCode="500" subStatusCode="19" path="500.html" responseMode="Redirect"/>


Why this is happening, I do not understand. Do you know anything about this problem?


source to share

All Articles