共用方式為


<customErrors> Element

Indicates whether the server channels in this application domain return filtered or complete exception information to local or remote callers.

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

<customErrors 
   mode="off|on|remoteOnly"
/>

Required Attributes

Attribute Description
mode 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.

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 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>

Requirements

Configuration Files: Application configuration file, machine configuration file (Machine.config)

Platform: This element is supported in the .NET Framework version 1.1 or later on Microsoft Windows 98 or later.

See Also

RemotingConfiguration.CustomErrorsEnabled | Remoting Settings Schema