ChannelFactory<TChannel> Constructor (Type)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Protected Sub New ( _
    channelType As Type _
)
protected ChannelFactory(
    Type channelType
)

Parameters

  • channelType
    Type: System.Type
    An interface that identifies the type of channel produced by the factory.

Exceptions

Exception Condition
ArgumentNullException

channelType is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

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

Examples

            'Create a request channel specifying a remote endpoint address
            Dim address3 As New EndpointAddress("https://localhost:8000/ChannelApp")
            Dim factory3 As New ChannelFactory(Of IRequestChannel)("MyEndpointConfig")
            factory3.CreateChannel(address3)
//Create a request channel specifying a remote endpoint address
EndpointAddress address3 = new EndpointAddress("https://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory3 = new ChannelFactory<IRequestChannel>("MyEndpointConfig");
factory3.CreateChannel(address3);

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.