ChannelFactory<TChannel> ChannelFactory<TChannel> ChannelFactory<TChannel> ChannelFactory<TChannel> Constructors

Definition

Overloads

ChannelFactory<TChannel>() ChannelFactory<TChannel>() ChannelFactory<TChannel>()

Initializes a new instance of the ChannelFactory<TChannel> class.

ChannelFactory<TChannel>(Binding) ChannelFactory<TChannel>(Binding) ChannelFactory<TChannel>(Binding)

Initializes a new instance of the ChannelFactory<TChannel> class.

ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint)

Initializes a new instance of the ChannelFactory<TChannel> class that produces channels with a specified endpoint.

ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified endpoint configuration name.

ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type)

Initializes a new instance of the ChannelFactory<TChannel> class.

ChannelFactory<TChannel>(Binding, EndpointAddress) ChannelFactory<TChannel>(Binding, EndpointAddress) ChannelFactory<TChannel>(Binding, EndpointAddress)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified binding and endpoint address.

ChannelFactory<TChannel>(Binding, String) ChannelFactory<TChannel>(Binding, String) ChannelFactory<TChannel>(Binding, String)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified binding and remote address.

ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress)

Initializes a new instance of the ChannelFactory<TChannel> class associated with a specified name for the endpoint configuration and remote address.

ChannelFactory<TChannel>() ChannelFactory<TChannel>() ChannelFactory<TChannel>()

Initializes a new instance of the ChannelFactory<TChannel> class.

public:
 ChannelFactory();
public ChannelFactory ();
Public Sub New ()

Examples

This example shows how to create a new object of the ChannelFactory<TChannel> class with the IRequestChannel interface.

EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint", address);

ChannelFactory<TChannel>(Binding) ChannelFactory<TChannel>(Binding) ChannelFactory<TChannel>(Binding)

Initializes a new instance of the ChannelFactory<TChannel> class.

public:
 ChannelFactory(System::ServiceModel::Channels::Binding ^ binding);
public ChannelFactory (System.ServiceModel.Channels.Binding binding);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding -> System.ServiceModel.ChannelFactory<'Channel>

Parameters

binding
Binding Binding Binding Binding

The Binding specified for the channels produced by the factory.

Remarks

Use this constructor when you want to pass the binding information programmatically rather than using an application configuration file.

ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint) ChannelFactory<TChannel>(ServiceEndpoint)

Initializes a new instance of the ChannelFactory<TChannel> class that produces channels with a specified endpoint.

public:
 ChannelFactory(System::ServiceModel::Description::ServiceEndpoint ^ endpoint);
public ChannelFactory (System.ServiceModel.Description.ServiceEndpoint endpoint);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Description.ServiceEndpoint -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpoint As ServiceEndpoint)

Parameters

endpoint
ServiceEndpoint ServiceEndpoint ServiceEndpoint ServiceEndpoint

The ServiceEndpoint for the channels produced by the factory.

Exceptions

Examples

ContractDescription contract = new ContractDescription("MyContract");
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
BasicHttpBinding binding = new BasicHttpBinding();
ServiceEndpoint endpoint = new ServiceEndpoint(contract, binding, address);

ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(endpoint);

Remarks

Use this constructor when you want to pass the service endpoint information programmatically rather than using an application configuration file.

ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String) ChannelFactory<TChannel>(String)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified endpoint configuration name.

public:
 ChannelFactory(System::String ^ endpointConfigurationName);
public ChannelFactory (string endpointConfigurationName);
new System.ServiceModel.ChannelFactory<'Channel> : string -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpointConfigurationName As String)

Parameters

endpointConfigurationName
String String String String

The configuration name used for the endpoint.

Exceptions

Examples

ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint");

Remarks

Use this constructor when there is more than one target endpoint in the application configuration file.

ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type) ChannelFactory<TChannel>(Type)

Initializes a new instance of the ChannelFactory<TChannel> class.

protected:
 ChannelFactory(Type ^ channelType);
protected ChannelFactory (Type channelType);
new System.ServiceModel.ChannelFactory<'Channel> : Type -> System.ServiceModel.ChannelFactory<'Channel>
Protected Sub New (channelType As Type)

Parameters

channelType
Type Type Type Type

The Type of channel produced by the factory.

Exceptions

The channelType is a class or value type and is not an interface.

Remarks

Use this constructor when you want to pass the channel type information programmatically rather than using an application configuration file. The channelType parameter must be an interface.

ChannelFactory<TChannel>(Binding, EndpointAddress) ChannelFactory<TChannel>(Binding, EndpointAddress) ChannelFactory<TChannel>(Binding, EndpointAddress)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified binding and endpoint address.

public:
 ChannelFactory(System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ remoteAddress);
public ChannelFactory (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> System.ServiceModel.ChannelFactory<'Channel>

Parameters

binding
Binding Binding Binding Binding

The Binding used to configure the endpoint.

remoteAddress
EndpointAddress EndpointAddress EndpointAddress EndpointAddress

The EndpointAddress that provides the location of the service.

Exceptions

Examples

BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(binding, address);

Remarks

Use this constructor when you want to pass the binding and address information programmatically rather than using an application configuration file.

ChannelFactory<TChannel>(Binding, String) ChannelFactory<TChannel>(Binding, String) ChannelFactory<TChannel>(Binding, String)

Initializes a new instance of the ChannelFactory<TChannel> class with a specified binding and remote address.

public:
 ChannelFactory(System::ServiceModel::Channels::Binding ^ binding, System::String ^ remoteAddress);
public ChannelFactory (System.ServiceModel.Channels.Binding binding, string remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding * string -> System.ServiceModel.ChannelFactory<'Channel>

Parameters

binding
Binding Binding Binding Binding

The Binding used to configure the endpoint.

remoteAddress
String String String String

The address that provides the location of the service.

Exceptions

Examples

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

ChannelFactory<IRequestChannel> factory =
 new ChannelFactory<IRequestChannel>(binding, "http://fsHost/fs/endp");

IRequestChannel channel = factory.CreateChannel(address, via);
channel.Open();
Message request = Message.CreateMessage(MessageVersion.Soap11, "hello");
Message reply = channel.Request(request);
Console.Out.WriteLine(reply.Headers.Action);
reply.Close();
channel.Close();
factory.Close();

Remarks

Use this constructor when you want to pass the information about the remote address information with a string rather than as a typed object.

ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress) ChannelFactory<TChannel>(String, EndpointAddress)

Initializes a new instance of the ChannelFactory<TChannel> class associated with a specified name for the endpoint configuration and remote address.

public:
 ChannelFactory(System::String ^ endpointConfigurationName, System::ServiceModel::EndpointAddress ^ remoteAddress);
public ChannelFactory (string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : string * System.ServiceModel.EndpointAddress -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpointConfigurationName As String, remoteAddress As EndpointAddress)

Parameters

endpointConfigurationName
String String String String

The configuration name used for the endpoint.

remoteAddress
EndpointAddress EndpointAddress EndpointAddress EndpointAddress

The EndpointAddress that provides the location of the service.

Exceptions

endpointConfigurationName or remoteAddress is null.

Examples

EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint", address);

Applies to