How to remove error messages - IIS7

2019-01-25 12:46发布

问题:

I'm wondering how to remove the error messages IIS7 adds to the top of the page.

I have my own 500 and 404 error pages served.

Not needing the error pages I have deleted them, but I am still getting this on top of my page:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

Any ideas?

回答1:

To prevent IIS7 hijacking your error pages, set existingResponse="PassThrough" in your httpErrors section in your web.config file. For example:

<configuration>
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>
</configuration>


回答2:

You can also go into IIS manager --> Error Pages then click on the right on "Edit feature settings..." And set the option to "Detailed errors" then it will be your application that process the error and not IIS.



标签: iis iis-7