IChannelFactory<TChannel>.CreateChannel Method

Definition

Creates a channel of a specified type to a specified endpoint address.

Overloads

CreateChannel(EndpointAddress)

Creates a channel of a specified type to a specified endpoint address.

CreateChannel(EndpointAddress, Uri)

Creates a channel of a specified type to a specified endpoint address and transport address to which messages are sent.

Remarks

Use the CreateChannel(EndpointAddress, Uri) overload to distinguish the address to which the message is initially sent from the ultimate destination when you want to do manual routing. Note that any channels created by this channel factory are closed when the channel factory is closed. For a discussion of addressing, see the Addresses topic.

CreateChannel(EndpointAddress)

Source:
IChannelFactory.cs
Source:
IChannelFactory.cs

Creates a channel of a specified type to a specified endpoint address.

C#
public TChannel CreateChannel(System.ServiceModel.EndpointAddress to);

Parameters

to
EndpointAddress

The EndpointAddress that provides the location of the service.

Returns

TChannel

A channel of type TChannel to the specified endpoint address.

Remarks

Use the CreateChannel(EndpointAddress, Uri) overload to distinguish the address to which the message is initially sent from the ultimate destination when you want to do manual routing. Note that any channels created by this channel factory are closed when the channel factory is closed.

Applies to

.NET 10 (package-provided) 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

CreateChannel(EndpointAddress, Uri)

Source:
IChannelFactory.cs
Source:
IChannelFactory.cs

Creates a channel of a specified type to a specified endpoint address and transport address to which messages are sent.

C#
public TChannel CreateChannel(System.ServiceModel.EndpointAddress to, Uri via);

Parameters

to
EndpointAddress

The EndpointAddress that provides the location of the service.

via
Uri

The Uri that contains the transport address to which the message is sent.

Returns

TChannel

A channel of type TChannel to the specified endpoint address and transport address.

Remarks

The transport address specified by the via is the location to which a message should initially be sent on its way to some other remote address specified by the to at which the service is located. In most Internet scenarios, the via URI is the same as the Uri of the final to address of the service. You only distinguish between these two addresses when you want to do some kind of manual routing. Note that any channels created by this channel factory are closed when the channel factory is closed. For a discussion of addressing, see the Addresses topic.

Applies to

.NET 10 (package-provided) 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0