locked
Use of web.config httpErrors section generates 500 error RRS feed

  • Question

  • User2009490896 posted

    I have an old ASP based application which relies on a 404 redirect in web.config to manage requests for certain pages. This has always worked fine in every instance.

    Until today when deploying a site - unusually for me - to a third party server. This simply will not have it.

    Nothing especially exciting going on here:

     <system.webServer>
            <httpErrors errorMode="Custom">
               <remove statusCode="404" subStatusCode="-1" /> 
                <error statusCode="404" path="/errors/404.htm" responseMode="ExecuteURL" />
            </httpErrors>
     </system.webServer>

    Site pages render fine until you hit a 404. That then returns "The page cannot be displayed because an internal server error has occurred."

    The error page in question is fine in itself. Actually it's normally an .asp not a .htm - I swapped it to a static file for testing.

    The problem specifically is that section of code above. Take it away and a 404 error returns, unsurprisingly, a 404 error.

    Put it back, and a 404 error in fact returns a 500 error. It doesn't even get as far as that .htm error page. It's that block of code above which offends it so.

    On this occasion, I don't have RDP access to this server, only FTP access.

    Anyone know why this particular server doesn't like that config section? This has me stumped.


     

    Monday, September 23, 2013 11:21 AM

Answers

  • User311508580 posted

    Hi DTMark,

    If you see 500 internal server error, you need to ask your hosting provider to check the full error message here. 500 internal server error is very generic issue.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 23, 2013 11:49 PM

All replies

  • User551462331 posted

    I suspect that path of 404.htm itself is not correct... make sure the errors folder exists in root of application and it contains 404.htm

    if u r getting internal server error, then does it display error message if u dont set 500 error page and custimerror mode is on

    hope this helps...

    Monday, September 23, 2013 2:24 PM
  • User2009490896 posted

    The path is correct - the 404.htm file is present and can be reached directly in the browser. All it does it write "404 error test".

    My instinct is that to get the error to render in the browser will require the ASP setting "Send errors to browser" enabled, which is something I'd normally never do and can't do anyway since I don't have RDP access. It doesn't matter what you set for CustomErrorMode, all you get is the text "The page cannot be displayed because an internal server error has occurred."

    That is the result of it evaluating that code block in web.config. Actually you can remove 404.htm entirely, the result is the same. It only errors when it hits a 404 condition and has to refer to that config section it doesn't like - a page which does exist serves fine.

    I did come across a thread about hosting with GoDaddy which seems to require you to set the 404 page in the control panel for the hosting package, setting it in web.config doesn't work - they managed to disable this functionality somehow.

    This is not that host, but I can only imagine it's something similar. It doesn't have a control panel, so I think I'm going to have to have the client ask them to look into this and RDP to the server and set it manually in IIS. But then all that does is update web.config so I can't see how this can work.

    This is "known good" code so failing that I think it might be time to advise the client to change hosts, as I can't see any other option. This is really bizarre.

    Monday, September 23, 2013 6:40 PM
  • User311508580 posted

    Hi DTMark,

    If you see 500 internal server error, you need to ask your hosting provider to check the full error message here. 500 internal server error is very generic issue.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 23, 2013 11:49 PM
  • User-166373564 posted

    Hi DTMark

    Until today when deploying a site - unusually for me - to a third party server. This simply will not have it.

    Our Configuration and Deployment forum deals with relevant issues about deploying asp.net applications to IIS, for this problem, you could consult your hosting provider as our community member mentioned above, I think they can give precise troubleshooting for this problem.

    Regards

    Tuesday, September 24, 2013 1:08 AM