RemotingConfiguration.CustomErrorsEnabled(Boolean) 方法

定义

指示此应用程序域中的服务器信道是向本地或远程调用方返回经过筛选的异常信息,还是返回完整的异常信息。Indicates whether the server channels in this application domain return filtered or complete exception information to local or remote callers.

public:
 static bool CustomErrorsEnabled(bool isLocalRequest);
public static bool CustomErrorsEnabled (bool isLocalRequest);
static member CustomErrorsEnabled : bool -> bool
Public Shared Function CustomErrorsEnabled (isLocalRequest As Boolean) As Boolean

参数

isLocalRequest
Boolean

true 用于指定本地调用方,false 用于指定远程调用方。true to specify local callers; false to specify remote callers.

返回

Boolean

如果只将筛选过的异常信息返回给本地调用方或远程调用方(具体返回给哪些调用方由 isLocalRequest 参数指定),则为 true;如果返回完整的异常信息,则为 falsetrue if only filtered exception information is returned to local or remote callers, as specified by the isLocalRequest parameter; false if complete exception information is returned.

注解

完整的异常信息包括确切的服务器异常信息和服务器堆栈跟踪信息。Complete exception information includes the exact server exception and the server stack trace. 筛选后的信息包括标准的远程异常信息,但不包括服务器堆栈跟踪信息。Filtered information includes a standard remoting exception but no server stack trace.

CustomErrorsEnabled方法反映在 mode <customErrors> 应用程序配置文件的元素的属性中指定的配置设置。The CustomErrorsEnabled method reflects configuration settings that were specified in the mode attribute of the <customErrors> element of the application configuration file. 有关配置选项的详细信息,请参阅 远程应用程序的配置For more information about configuration options, see Configuration of Remote Applications.

下表显示了三个服务器通道属性值,这些值指定哪些调用方会收到异常信息以及接收到的信息类型。The following table shows the three server channel property values that specify which callers receive exception information and what type of information they receive.

“值”Value 说明Description
off 所有调用方均收到完整的异常信息。All callers receive complete exception information.
on 所有调用方均收到筛选后的异常信息。All callers receive filtered exception information.
remoteOnly 本地调用方收到完整的异常信息,远程调用方收到筛选后的异常信息。Local callers receive complete exception information; remote callers receive filtered exception information.

下表显示了 isLocalRequest 参数和服务器信道属性的交互。The following table shows the interaction of the isLocalRequest parameter and the server channel property.

“值”Value isLocalRequestisLocalRequest 返回值Return value 说明Description
on true true 本地调用方接收筛选的异常信息。Local callers receive filtered exception information.
on false true 远程调用方接收筛选的异常信息。Remote callers receive filtered exception information.
off true false 本地调用方接收完整的异常信息。Local callers receive complete exception information.
off false false 远程调用方接收完整的异常信息。Remote callers receive complete exception information.
remoteOnly true false 本地调用方接收完整的异常信息。Local callers receive complete exception information.
remoteOnly false true 远程调用方接收筛选的异常信息。Remote callers receive filtered exception information.

有关使用应用程序配置文件来控制将异常信息返回给调用方的信息,请参阅 <customErrors> 元素。For information about using application configuration files to control the return of exception information to callers, see the <customErrors> element.

适用于