服务器上发生应用程序错误

本文关键字:应用程序 错误 服务器 | 更新日期: 2023-09-27 17:56:20

我正在尝试从 IIS 服务器访问 aspx 页。该页面包含一个注册表单。浏览器正在打开页面,但是当我尝试在字段中输入值并想要保存它时,它会显示此错误:

 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>

问题是什么,我该如何解决?

服务器上发生应用程序错误

似乎在保存时发生了一些错误,而您没有收到确切的错误。因此,您有两个选项在代码中添加。

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

或在您的保存函数中使用 try catch 并在 catch 块中放置代码将 enitire 异常作为字符串写入文本文件中,然后在文本文件中出现确切的错误。

但我建议第一种选择。