<clientProviders> Element (Instance)
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 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.
Providers here override this channel's default providers wherever this channel template is referenced.
Providers here override default providers for this channel instance only.
Contains a formatter sink to be inserted into the channel sink call chain. Can occur once in the <clientProviders> instance element.
Contains a channel sink to be inserted into the channel sink call chain. Can occur one or more times in the <clientProviders> instance element.
When used in a channel template element, any referenced or declared providers at the level shown will override the channel's default providers and become the default providers if the channel is referenced elsewhere in the configuration file. It is important to realize that all default providers or formatters for this channel are overridden when this element is used. If you want those providers or formatters to be part of this channel template in addition to any custom providers, you must specify all providers and the formatter you want to be used with this channel when referenced by others.
When used in a channel instance, any referenced or declared providers at the level shown will override this channel's default providers for this channel instance only. If this instance references a template that declares clientProviders, then the providers indicated here will completely override those as well.
The following configuration file uses a <channels> template element to declare an HttpChannel with the id "httpbinary" and uses the <clientProviders> template element to specify BinaryClientFormatterSink to serialize the remote calls. It then requests that this client application use that particular channel configuration by specifying
ref="httpbinary" in the <channel> instance element inside the <application> element. Finally, it uses a <clientProviders> instance element to add a "propsetter" channel sink provider and passes some custom configuration elements that will be used by that channel sink provider. Note that any use of the type attribute to specify a type in an assembly that is in the global assembly cache requires complete type information, including version, culture, and public key information. That information has been omitted from the type attributes below for brevity.
<configuration> <system.runtime.remoting> <channelSinkProviders> <clientProviders> <provider id="propsetter" type="ChannelSinkPropertySetterProvider, PropsSink" /> </clientProviders> <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"> <clientProviders> <provider ref="propsetter" username="somename" writeToConsole="true" > <endpoint url="contoso.com:9000" someProp="xyz" /> <endpoint url="contoso.com:9001" someProp="123" /> </provider> </clientProviders> </channel> </channels> <client> <wellknown url="http://computername:80/RemoteType.rem" type="RemoteType, RemoteAssembly" /> </client> </application> </system.runtime.remoting> </configuration>