<customErrors> Element

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the  Windows Communication Foundation (WCF).

Indicates whether the server channels in this application domain return filtered or complete exception information to local or remote callers. This element may appear in an application configuration file or a machine configuration file. This element is supported in the .NET Framework version 1.1 or later on Microsoft Windows 98 or later.

Schema Hierarchy

<configuration>
  <system.runtime.remoting> Element
    <customErrors> Element

Syntax

<customErrors  
   mode="Off|On|RemoteOnly" 
/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

mode

Required attribute.

Indicates whether the server channels in this application domain return filtered or complete exception information to local or remote callers. The default is RemoteOnly, which returns complete exception information (including the stack trace) only to callers on the same computer as the server.

Child Elements

None.

Parent Elements

Element Description

configuration

The root element in every configuration file used by the common language runtime and .NET Framework applications.

system.runtime.remoting

Contains information about remote objects and channels.

Remarks

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.

The following table describes the three server channel property values that specify which callers receive exception information and the 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.

Example

The following configuration file example tells the .NET Framework remoting system to register a server channel on behalf of a client application domain so that the client domain can pass a delegate to be used as a callback. Specifying <customErrors mode="Off"/> causes the server to receive complete exception information, including the stack trace, if an exception occurs on the client during the callback.

<configuration>

<system.runtime.remoting>

<application>

<client url="http://computername:8080">

<activated type="ClientActivatedType, RemoteType"/>

</client>

<channels>

<channel ref="http" port="0">

<serverProviders>

<formatter ref="soap" typeFilterLevel="Full"/>

<formatter ref="binary" typeFilterLevel="Full"/>

</serverProviders>

</channel>

</channels>

</application>

<customErrors mode="Off"/>

</system.runtime.remoting>

</configuration>

See Also

Reference

Remoting Settings Schema
System.Runtime.Remoting.RemotingConfiguration.CustomErrorsEnabled(System.Boolean)