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

Creates a channel of a specified type that is used to send messages to a service endpoint at a specified transport address 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,
	Uri via
)

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.

via
Type: System.Uri

The Uri that contains the transport address to which the channel sends messages.

Return Value

Type: TChannel
The TChannel of type IChannel created by the factory.

ExceptionCondition
InvalidOperationException

The ChannelFactory has duplex operations it does not support.


	       EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
	       Uri uri = new Uri("http://localhost:8000/Via");

	       IRequestChannel channel =
		  ChannelFactory<IRequestChannel>.CreateChannel(binding, address, uri);
	       channel.Open();

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft