共用方式為


<channels> Element (Template)

Contains channel templates that the application uses to communicate with remote objects. Channels declared under this element are available for referencing anywhere a channel is registered.

<configuration>
   <system.runtime.remoting>
      <channels>

<channels>
   <channel/>
</channels>

Child Element

Element Description
<channel> Contains the channel template that the application can specify and configure to communicate with or listen to requests for remote objects. Occurs one or more times in the <channels> element.

Remarks

Channel templates can be in application configuration files, separate configuration files, or the machine configuration file.

Example

The following configuration file uses a <channels> template element to declare an HttpChannel with the id "httpbinary" that uses the BinaryClientFormatterSink to serialize the remote calls. It then requests that this client application use that particular channel configuration by specifying ref="httpbinary" in the <channel> instance element inside the <application> element. Note that any use of the type attribute to specify a type in an assembly that is in the global assembly cache requires complete type information, including version, culture, and public key information. That information has been omitted from the type attributes below for brevity.

<configuration>
   <system.runtime.remoting>
      <channels>
         <channel 
            type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting, ...." 
            id="httpbinary"
         >
            <clientProviders>
                  <formatter
                      type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting, ...."
               />
            </clientProviders>
         </channel>
      </channels>
      <application>
         <channels>
            <channel ref="httpbinary"/>
         </channels>
         <client>
            <wellknown 
               url="http://computername:80/RemoteType.rem"
               type="RemoteType, RemoteAssembly"
            />
         </client>
      </application>
      <debug loadTypes="true"/>
   </system.runtime.remoting>
</configuration>

Requirements

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

See Also

Remoting Settings Schema | Sinks and Sink Chains