自定义错误 [英] Custom errors

查看:103
本文介绍了自定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该是常见问题,但我找不到任何具体的答案参考,所以如果之前已经回答过,我提前道歉。

我有一个远程应用程序(与ASP.NET无关) )。我正在测试应用程序但在客户端我得到:


System.Runtime.Remoting.RemotingException:服务器遇到内部错误。有关更多信息,请关闭服务器.config文件中的customErrors。

我已将以下内容添加到app.config(是的,我查看了程序集配置文件和此部分也传播到该配置文件):

< system.runtime.remoting >

This should be an FAQ but I couldn't find any specific reference to the answer so I apologize in advance if it has been answered before.

I have a remoting application (NOT associated with ASP.NET). I am testing the application but on the client side I get:

System.Runtime.Remoting.RemotingException: Server encountered an internal error. For more information, turn off customErrors in the server's .config file.

I have added the following to app.config (and yes, I looked at the assembly config file and this section get propagated to that config file also):

<system.runtime.remoting>

< customErrors mode = " Off " />

    <customErrors mode="Off" />

< / system.runtime.remoting >


但我没有得到任何更多细节,我得到同样的错误。我开始认为这个配置条目被忽略或语法不正确。此配置部分现在位于客户端和服务器上,我仍然没有在返回的错误中获得任何其他信息。只是'关闭服务器的.config文件中的customErrors'。

建议?

Kevin

推荐答案

为确保您的app.config命名合适?即ExecutableName.Config,而不仅仅是app.config,是吗?确保配置文件的名称与服务器应用程序的名称相匹配。

另一种方法是以编程方式将RemotingConfiguration.CustomErrorsMode设置为您想要的值。尝试将其作为第二种选择。

让我知道会发生什么。

Just to make sure, is your app.config named appropriately?  i.e. ExecutableName.Config, not just app.config, yes?  Make sure the name of the configuration file matches that of the server application.

Another way is to programmatically set RemotingConfiguration.CustomErrorsMode to the value you desire.  Try that as a second option.

Let me know what happens.


这篇关于自定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆