500.19 error in IIS7 when an error occurs

Joel picture Joel · Mar 18, 2010 · Viewed 48.3k times · Source

Setup: Windows 7, IIS7. I am working on an app that is being viewed through the local IIS server, not the built in debugging web server. So my app url is http://localhost/foo/bar.aspx. There is no <customErrors> section in my web.config, and I haven't changed any settings in IIS.

If any error occurs, I always get the following error screen:

HTTP Error 500.19 - Internal Server Error
Absolute physical path "C:\inetpub\custerr" is not allowed in system.webServer/httpErrors section in web.config file. Use relative path instead.

Here's my applicationhost.config contents:

<httpErrors errorMode="Custom" lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
  <error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="401.htm" />
  <error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="403.htm" />
  <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" />
  <error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="405.htm" />
  <error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="406.htm" />
  <error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="412.htm" />
  <error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" />
  <error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="501.htm" />
  <error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="502.htm" />
</httpErrors>

How can I get rid of this configuration error so I can see detailed errors?

Answer

firedfly picture firedfly · Apr 2, 2010

I've been dealing with this issue for the last few days and found the solution. A Web.Config file is likely specifying an absolute path for one of the error pages. This may not be the Web.Config of the application you are testing. For me, it was the website's Web.Config file.

  1. If you find the offending Web.Config file you can remove the absolute path and the problem should be fixed.

  2. A much easier solution would be to alter your ApplicationHost.Config file to set the allowAbsolutePathsWhenDelegated property to true:

    <httpErrors allowAbsolutePathsWhenDelegated="true" errorMode="Custom" 
                lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">