Asp.net 如何让web.config文件远程显示错误?

Asp.net 如何让web.config文件远程显示错误?,asp.net,web-config,Asp.net,Web Config,我正在尝试查看我的网站的错误,当我访问该网站时,我收到以下消息: Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being

我正在尝试查看我的网站的错误,当我访问该网站时,我收到以下消息:

Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

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

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
“/”应用程序中出现服务器错误。 运行时错误 描述:服务器上发生应用程序错误。此应用程序的当前自定义错误设置阻止远程查看应用程序错误的详细信息(出于安全原因)。但是,本地服务器上运行的浏览器可以查看它。 详细信息:要在远程计算机上查看此特定错误消息的详细信息,请在位于当前web应用程序根目录中的“web.config”配置文件中创建一个标记。然后,该标记的“mode”属性应设置为“Off”。 注意:通过修改应用程序配置标记的“defaultRedirect”属性以指向自定义错误页URL,可以将当前看到的错误页替换为自定义错误页。 因此,我所做的是创建一个web.config文件,其中包含以下内容:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
     <customErrors mode="Off"/>
  </system.web>
</configuration>

但对我来说不幸的是,这真的让杰克与众不同。伙计们,我做错了什么

试试这个:


顺便说一下,asp net项目模板包括web.config文件(它应该在项目的根文件夹中),因此您不必手动创建它。可能是您创建了另一个错误?

如果您在本地(而不是远程)看到错误,请尝试将其添加到web.config

<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>

这是IIS的一项功能,用于向外部用户隐藏可能危及网站内部工作的信息,因此它不是默认设置的det是有原因的。

它可能不是IIS

我在本页上尝试了两种解决方案,以及其他几种。他们都没有解决我们的问题,但他们是好东西检查,将导致问题。所以先检查一下。如果您仍在使用PHP,请检查您的PHP设置

对我来说,修复它的方法是编辑我们的php.ini文件并指定:

display_errors: On
我还设定:

display_startup_errors: On
只是为了更好的衡量


这就解决了问题,而我们真正的问题是在开发阶段迁移过程中忽略了一个逗号。

这与ASP。。。PHP!=ASP