Share via


<provider> Element (Template)

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the  Windows Communication Foundation (WCF).

Contains the channel sink provider template for a channel sink that is to be inserted into the server or client channel sink chain. There are two possible hierarchies for the inclusion of this element. This element may occur in an application configuration file, machine configuration file.

Schema Hierarchy

<configuration>
  <system.runtime.remoting> Element
    <channelSinkProviders> Element
      <clientProviders> Element (Instance)
        <provider> Element (Template)

Syntax

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

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

id

Required attribute.

Specifies a string that identifies this channel sink provider. Others can use this string in their ref attribute to bind to this channel sink provider.

type

Required attribute.

Specifies the full type name of the channel sink provider and the name of the assembly containing the provider implementation. This includes version, culture, and public key information if the containing assembly is in the global assembly cache.

customChannelSinkProperty

Optional attribute.

Indicates a supported custom channel sink property. You can specify any number of provider and channel sink properties that custom channel sink providers and their sinks might support. A custom channel sink property would be specified with an attribute/value pair. In the example:

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

the customChannelSinkProperty attribute and its value will be available as an IDictionary argument in the constructor of the provider.

Custom sink provider data can also be specified here. Only one level of nodes is supported. In the example:

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

the extra information will be available as an ICollection of SinkProviderData in the constructor of the provider.

Child Elements

None.

Parent Elements

Element Description

channelSinkProviders

Contains templates for client and server channel sink providers. Any channel sink providers specified underneath this element can be referenced anywhere a channel sink provider might be registered.

clientProviders

Contains providers for channel sinks that are to become part of the default client-side channel sink call chain for this channel template when the template is referenced elsewhere in the configuration file. Specifying providers in either position below overrides the default channel sinks for this channel; if you expect any of those default channel sinks to be inserted into the channel sink call chain for this template, you must specify them here.

configuration

The root element in every configuration file used by the common language runtime and .NET Framework applications.

system.runtime.remoting

Contains information about remote objects and channels.

Example

The following configuration file uses a <provider> instance element to assign to the HttpChannel the "propsetter" and a "null" channel sink provider that themselves were declared with <provider> template elements. In addition, the "propsetter" channel sink provider will be created with the custom provider properties specified as attributes on the provider instance element and as the child <endpoint> attribute name/value pairs.

<configuration>
   <system.runtime.remoting>
      <application>
         <client>
            <wellknown 
               type="RemoteType, RemoteAssembly"
               url="https://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>

See Also

Reference

Remoting Settings Schema

Concepts

Sinks and Sink Chains

Copyright © 2007 by Microsoft Corporation. All rights reserved.