次の方法で共有


<bindingElementExtensions>

このセクションでは、コンピューターまたはアプリケーション構成ファイルからカスタム バインド要素を使用できます。 このコレクションにカスタム バインド要素を追加するには、 add キーワードを使用し、要素の type 属性をバインド要素拡張に設定し、カスタム バインド要素に name 属性を設定します。

バインド拡張機能を使用すると、ユーザーはカスタム バインドの一部として使用するユーザー定義のバインド要素を作成できます。 プログラムによって、バインディング拡張機能は抽象クラス BindingElementを実装する型です。 構成ファイルでは、 bindingElementExtensions セクションを使用して拡張要素を定義します。

次の例では、 add 要素と name 属性を使用して、構成ファイルの bindingElementExtensions セクションにバインド拡張機能を追加します。

<system.serviceModel>
  <extensions>
    <bindingElementExtensions>
      <add name="udpTransport"
           type="Microsoft.ServiceModel.Samples.UdpTransportSection, UdpTransport,
                 Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </bindingElementExtensions>
  </extensions>
</system.serviceModel>

要素に構成機能を追加するには、ユーザーが bindingElementExtensionSection 要素を記述して登録する必要があります。 詳細については、 System.Configuration ドキュメントを参照してください。

要素とその構成型を定義した後、次の例に示すように、拡張機能をカスタム バインドの一部として使用できます。

<customBinding>
  <binding name="test2">
    <udpTransport />
    <binaryMessageEncoding maxReadPoolSize="211"
                           maxWritePoolSize="2132"
                           maxSessionSize="3141" />
  </binding>
</customBinding>

こちらも参照ください