ChannelFactory<TChannel>.CreateChannel Method (Binding, EndpointAddress)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a channel of a specified type that is used to send messages to a service endpoint that is configured with a specified binding.

Namespace:   System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public static TChannel CreateChannel(
	Binding binding,
	EndpointAddress endpointAddress
)

Parameters

binding
Type: System.ServiceModel.Channels.Binding

The Binding used to configure the endpoint.

endpointAddress
Type: System.ServiceModel.EndpointAddress

The EndpointAddress that provides the location of the service.

Return Value

Type: TChannel

The TChannel of type IChannel created by the factory.

Exception Condition
InvalidOperationException

The ChannelFactory has duplex operations it does not support.


EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
IRequestChannel channel = ChannelFactory<IRequestChannel>.CreateChannel(binding, address);
channel.Open();

.NET Framework
Available since 3.0
Return to top
Show: