The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
BindingElement::BuildChannelFactory<TChannel> Method (BindingContext^)
.NET Framework (current version)
Initializes a channel factory for producing channels of a specified type from the binding context.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
public: generic<typename TChannel> virtual IChannelFactory<TChannel>^ BuildChannelFactory( BindingContext^ context )
Parameters
- context
-
Type:
System.ServiceModel.Channels::BindingContext^
The BindingContext that provides context for the binding element.
Return Value
Type: System.ServiceModel.Channels::IChannelFactory<TChannel>^The IChannelFactory<TChannel> of type TChannel initialized from the context.
Type Parameters
- TChannel
The type of channel the factory builds.
| Exception | Condition |
|---|---|
| ArgumentNullException | context is null. |
CustomBinding binding = new CustomBinding(); HttpTransportBindingElement element = new HttpTransportBindingElement(); BindingParameterCollection parameters = new BindingParameterCollection(); BindingContext context = new BindingContext(binding, parameters); IChannelFactory<IRequestChannel> factory = element.BuildChannelFactory<IRequestChannel>(context); factory.Open(); EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp"); IRequestChannel channel = factory.CreateChannel(address); channel.Open(); Message request = Message.CreateMessage(MessageVersion.Default, "hello"); Message reply = channel.Request(request); Console.Out.WriteLine(reply.Headers.Action); reply.Close(); channel.Close(); factory.Close();
Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: