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

时间:2015-06-16 05:23:06

标签: c# asp.net sql-server

我正在尝试从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>

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

1 个答案:

答案 0 :(得分:1)

似乎虽然保存了一些错误,但您没有得到确切的错误。 所以你有两个选项添加下面的代码。

<asp:HyperLink runat="server" CssClass="fancybox" rel="group" NavigateUrl='<%# Eval("Value") %>'>
    <asp:Image ID="Image1" runat="server" 
        ImageUrl='<%# Eval("Value") %>' 
        Width="50%" />
</asp:HyperLink>

或者在你的保存函数和catch块中使用try catch把代码写为文本文件中的字符串enitire异常,然后在文本文件中你会有错误。

但我建议先选择。