包含应用程序用来与远程对象进行通信的信道模板。在此元素下声明的信道可用于引用注册了信道的任何位置。
<configuration>
<system.runtime.remoting> 元素
<channels> 元素(模板)
<channels> 
   <channel/> 
</channels>
属性和元素
以下几节介绍属性、子元素和父元素。
属性
无。
子元素
| 元素 | 说明 | 
|---|---|
| 包含某信道模板,应用程序可指定并配置该信道模板,以便与远程对象进行通信或侦听对远程对象的请求。可在 <channels> 元素中出现一次或多次。 | 
父元素
| 元素 | 说明 | 
|---|---|
| configuration | 公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中的根元素。 | 
| system.runtime.remoting | 包含有关远程对象和信道的信息。 | 
备注
信道模板可位于应用程序配置文件、单独的配置文件或计算机配置文件中。
示例
下面的配置文件使用 <channels> 模板元素来声明 id 为“httpbinary”的 HttpChannel,它使用 BinaryClientFormatterSink 序列化远程调用。然后通过在 <application> 元素内的 <channel> 实例元素中指定 ref="httpbinary",请求此客户端应用程序使用该特定的信道配置。注意,只要使用 type 属性为全局程序集缓存中的程序集指定类型,就需要完整的类型信息,包括版本、区域性和公钥信息。为了简洁起见,下面的 type 属性中省略了这些信息。
<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>
请参见
参考
概念
.gif)
版权所有 (C) 2007 Microsoft Corporation。保留所有权利。