Initializes a channel factory for producing channels of a specified type from the binding context.
Public Overridable Function BuildChannelFactory(Of TChannel) ( _ context As BindingContext _ ) As IChannelFactory(Of TChannel)
Dim instance As BindingElement Dim context As BindingContext Dim returnValue As IChannelFactory(Of TChannel) returnValue = instance.BuildChannelFactory(context)
public virtual IChannelFactory<TChannel> BuildChannelFactory<TChannel>( BindingContext context )
public: generic<typename TChannel> virtual IChannelFactory<TChannel>^ BuildChannelFactory( BindingContext^ context )
JScript does not support generic types or methods.
The type of channel the factory builds.
context is nullNothingnullptra null reference (Nothing in Visual Basic).
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();
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC