自定义错误标记不起作用 [“/”应用程序中的服务器错误。]

Custom Errors tag not working[Server Error in '/' Application.]

我不想删除错误,我只想隐藏此错误(“/”应用程序中的服务器错误)。但在 web.config 中,我的(customErrors 模式="Off")不工作。

  <configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>

这是我应用customErrors模式时的错误= "Off"

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

如果没有看到配置文件的其余部分,就不可能知道它有什么问题,但除此之外,我认为您误解了 <customErrors mode="Off"/> 的作用。它实际上会显示所有自定义错误模式中最详细的 "yellow screen of death"。 From here:

CustomErrors supports the following modes:

  • On – If defaultRedirect is specified, they will see that content. Otherwise the default error screen with fewer details.
  • Off – Detailed error details will be shown to the user. (the “yellow screen of death screen”)
  • RemoteOnly – Default value. Detailed errors only are shown to local users. Remote users receive custom error screens or fewer
    details.