共用方式為


<channels> 項目 (樣板)

包含應用程式用來與遠端物件通訊的通道樣板。在這個項目下方宣告的通道可供參考通道註冊的任一位置。

<configuration> 項目
  <system.runtime.remoting> 項目
    <channels> 項目 (樣板)

<channels> 
   <channel/> 
</channels>

屬性和項目

下列小節將說明屬性、子項目和父項目。

屬性

子項目

項目 描述

<channel>

包含應用程式可以指定及設定的通道樣板,以便與遠端物件的要求進行通訊,或接聽遠端物件的要求。這個項目在 <channels> 項目中出現一次或多次。

父項目

項目 描述

configuration

Common Language Runtime 和 .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>

請參閱

參考

遠端設定結構描述

概念

接收和接收鏈結