Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 CreateChannel Method (Binding, Endp...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.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)
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.
ExceptionCondition
InvalidOperationException

The ChannelFactory has duplex operations it does not support.

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

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.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker