Freigeben über


<provider> Element (Instance) 

Contains the channel sink provider for a channel sink that is to be inserted into the channel sink chain.

<configuration>

   <system.runtime.remoting>

      <channels>

         <channel>

            <serverProviders>

               <provider/>

Providers here override the default server providers for this channel to become the new default for this channel template.

<configuration>

   <system.runtime.remoting>

      <channels>

         <channel>

            <clientProviders>

               <provider/>

Providers here override the default client providers for this channel to become the new default for this channel template.

<configuration>

   <system.runtime.remoting>

      <application>

         <channels>

            <channel>

               <serverProviders>

                  <provider/>

Server providers here override the default providers for this channel instance.

<configuration>

   <system.runtime.remoting>

      <application>

         <channels>

            <channel>

               <clientProviders>

                  <provider/>

Client providers here override the default providers for this channel instance.

<provider 
   ref="ProviderTemplateReference"
   type="ProviderType, ProviderAssembly"
   customChannelSinkProperty="customProperty"
/>

Optional Attributes

Attribute Description

customChannelSinkProperty

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.

Required Attributes

Attribute Description

type

Specifies the full type name of the channel sink provider and the name of the assembly containing the provider implementation. This includes any version, culture, and public key information if the containing assembly is in the global assembly cache. This attribute is only required if you do not use a ref attribute.

ref

Specifies the ID of the channel sink provider template for the channel sink that your client intends to register for use. If you specify a ref attribute, you do not need to specify a type attribute.

Remarks

You reference another provider template by supplying that template's id value for this instance's ref attribute. Specifying providers overrides any default providers; if you intended other providers to be invoked in the course of the channel sink call chain, you must specify them here.

Instances of the <provider> element can occur in four places. When specified underneath a <channel> template element (under either the <serverProviders> or <clientProviders> element), this element specifies a provider that will be a default sink provider for that particular channel when it is referenced by an application instance. When specified underneath an <application> element, it overrides any default sinks that might have been configured for this channel if it were in a template. Any other providers you want in the call chain must be specified here, because including a provider here overrides all defaults specified in any template.

Example

The following configuration file uses a <provider> instance element to assign to the HttpChannel the "propsetter" and "null" channel sink providers that themselves were declared with <provider> template elements. In addition, the "propsetter" channel sink provider is 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="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" password="xyz" />
                     <endpoint url="contoso.com:9001" password="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>

Requirements

Configuration Files: Application configuration file, machine configuration file (Machine.config)

See Also

Reference

Remoting Settings Schema

Concepts

Sinks and Sink Chains