ChannelFactory<TChannel> Constructor (ServiceEndpoint)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

Namespace:   System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public ChannelFactory(
	ServiceEndpoint endpoint


Type: System.ServiceModel.Description.ServiceEndpoint

The ServiceEndpoint for the channels produced by the factory.

Exception Condition

The endpoint is null.

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

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

.NET Framework
Available since 3.0
Return to top