.NET Framework Class Library
ChannelFactory<(Of <(TChannel>)>)..::.CreateChannel Method (Binding, EndpointAddress)

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)
Syntax

Visual Basic (Declaration)
Public Shared Function CreateChannel ( _
    binding As Binding, _
    endpointAddress As EndpointAddress _
) As TChannel
Visual Basic (Usage)
Dim binding As Binding
Dim endpointAddress As EndpointAddress
Dim returnValue As TChannel

returnValue = ChannelFactory.CreateChannel(binding, _
    endpointAddress)
C#
public static TChannel CreateChannel(
    Binding binding,
    EndpointAddress endpointAddress
)
Visual C++
public:
static TChannel CreateChannel(
    Binding^ binding, 
    EndpointAddress^ endpointAddress
)
JScript
public static function CreateChannel(
    binding : Binding, 
    endpointAddress : EndpointAddress
) : TChannel

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.
Exceptions

ExceptionCondition
InvalidOperationException

The ChannelFactory has duplex operations it does not support.

Examples

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

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference

Tags :


Page view tracker