共用方式為


<provider> 項目 (樣板)

包含要插入伺服器或用戶端通道接收鏈結中的通道接收之通道接收提供者樣板。這個項目包含兩種可能的階層架構。

<configuration>

  <system.runtime.remoting> 項目

    <channelSinkProviders> 項目

      <clientProviders> 項目 (執行個體)

        <provider> 項目 (樣板)

<provider  
   id="ProviderID" 
   type="ProviderType, ProviderAssembly"    
   customChannelSinkProperty="customProperty"
/>

屬性和項目

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

屬性

屬性 說明

id

必要屬性。

指定識別這個通道接收提供者的字串。而其他通道接收提供者可以在它們的 ref 屬性中使用這個字串,以繫結至這個通道接收提供者。

type

必要屬性。

指定通道接收提供者的完整型別名稱,以及含有提供者實作的組件名稱。如果包含組件是在全域組件快取中,這個名稱包含版本、文化特性和公開金鑰 (Public Key) 資訊。

customChannelSinkProperty

選擇性屬性。

指示支援的自訂通道接收屬性。您可以指定自訂通道接收提供者和其接收可能支援的任何提供者及通道接收屬性數量。自訂通道接收屬性可以是以屬性/值配組指定的。在下列範例中:

<provider id="CustomChannelSinkProvider" type="Namespace.CustomChannelSinkProvider, CustomChannels" customChannelSinkProperty="ChannelSinkPropertyValue"/>

customChannelSinkProperty 屬性及其值將當做提供者之建構函式中的 IDictionary 引數使用。

您也可以在此指定自訂接收提供者資料。不過,只支援一個層級的節點。在下列範例中:

<provider ref="custom">
<extra data="value"/>
<extra data="AnotherValue"/>
</provider>

在提供者的建構函式中,額外資訊將當做 SinkProviderDataICollection 使用。

子項目

無。

父項目

項目 說明

channelSinkProviders

包含用戶端和伺服器通道接收提供者的樣板。任何指定在這個項目下的通道接收提供者可以在可能註冊通道接收提供者的任何位置上被參考。

clientProviders

包含通道接收的提供者,該通道接收會在樣板於組態檔的其他位置被參考時,成為這個通道樣板的預設用戶端通道接收呼叫鏈結的一部分。在下列位置指定提供者將會覆寫這個通道的預設通道接收;如果您希望任何這些預設的通道接收插入這個樣板的通道接收呼叫鏈結中,也必須在這裡指定。

configuration

Common Language Runtime 和 .NET Framework 應用程式所使用之每個組態檔中的根項目。

system.runtime.remoting

包含有關遠端物件和通道的資訊。

範例

下列組態檔使用 <provider> 執行個體項目,以指派 "propsetter" 和 "null" 通道接收提供者 (它們本身是以 <provider> 樣板項目宣告的) 給 HttpChannel。此外,將會建立 "propsetter" 通道接收提供者,其中自訂提供者屬性會指定為提供者執行個體項目上的屬性,同時指定為子代 <endpoint> 屬性名稱/值組。

<configuration>
   <system.runtime.remoting>
      <application>
         <client>
            <wellknown 
               type="RemoteType, RemoteAssembly"
               url="http://computername:8080/RemoteType.rem"/>
         </client>
         <channels>
            <channel ref="http">
               <clientProviders>
                  <formatter ref="soap"/>
                  <provider 
                     ref="propsetter" 
                     username="bob" 
                     writeToConsole="true"
                  >
                     <endpoint url="contoso.com:9000" someProperty="xyz" />
                     <endpoint url="contoso.com:9001" someProperty="123" />
                  </provider>
                  <provider ref="null" writeToConsole="true" />
               </clientProviders>
            </channel>
         </channels>
      </application>
      <channelSinkProviders>
         <clientProviders>
            <provider 
               id="propsetter" 
               type="ChannelSinkPropertySetterProvider, SinkAssembly" 
            />
            <provider 
               id="null" 
               type="NullSinkProvider, SinkAssembly" 
            />
         </clientProviders>
      </channelSinkProviders>
      <debug loadTypes="true" />
   </system.runtime.remoting>
</configuration>

請參閱

參考

遠端設定結構描述

概念

接收與接收鏈結

Footer image

Copyright © 2007 by Microsoft Corporation. All rights reserved.