ChannelFactory<TChannel> Konstruktoren

Definition

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

Überlädt

ChannelFactory<TChannel>()

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

ChannelFactory<TChannel>(Binding)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

ChannelFactory<TChannel>(ServiceEndpoint)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse, die Kanäle mit einem angegebenen Endpunkt erzeugt.

ChannelFactory<TChannel>(String)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einem angegebenen Endpunktkonfigurationsnamen.

ChannelFactory<TChannel>(Type)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

ChannelFactory<TChannel>(Binding, EndpointAddress)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einer angegebenen Bindung und Endpunktadresse.

ChannelFactory<TChannel>(Binding, String)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einer angegebenen Bindung und Remoteadresse.

ChannelFactory<TChannel>(String, EndpointAddress)

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse, die einem angegebenen Namen für die Endpunktkonfiguration und der Remoteadresse zugeordnet ist.

ChannelFactory<TChannel>()

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

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

Beispiele

Dieses Beispiel zeigt, wie ein neues Objekt der ChannelFactory<TChannel>-Klasse mit der IRequestChannel-Schnittstelle erstellt wird.

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

Gilt für:

ChannelFactory<TChannel>(Binding)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

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>
Public Sub New (binding As Binding)

Parameter

binding
Binding

Der für die von der Factory erzeugten Kanäle angegebene Binding.

Hinweise

Übergeben Sie mit diesem Konstruktor die Bindungsinformationen programmgesteuert anstatt mit einer Anwendungskonfigurationsdatei.

Gilt für:

ChannelFactory<TChannel>(ServiceEndpoint)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse, die Kanäle mit einem angegebenen Endpunkt erzeugt.

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)

Parameter

endpoint
ServiceEndpoint

Der für die von der Factory erzeugten Kanäle angegebene ServiceEndpoint.

Ausnahmen

endpoint ist null.

Beispiele

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

Hinweise

Übergeben Sie mit diesem Konstruktor die Dienstendpunktinformationen programmgesteuert anstatt mit einer Anwendungskonfigurationsdatei.

Gilt für:

ChannelFactory<TChannel>(String)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einem angegebenen Endpunktkonfigurationsnamen.

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)

Parameter

endpointConfigurationName
String

Der für die Endpunktkonfiguration verwendete Name.

Ausnahmen

endpointConfigurationName ist null.

Beispiele

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

Hinweise

Verwenden Sie diesen Konstruktor, wenn die Anwendungskonfigurationsdatei mehrere Zielendpunkte enthält.

Gilt für:

ChannelFactory<TChannel>(Type)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse.

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

Parameter

channelType
Type

Der Type des von der Factory erzeugten Kanals.

Ausnahmen

channelType ist null.

Der channelType ist eine Klasse oder ein Werttyp und keine Schnittstelle.

Hinweise

Übergeben Sie mit diesem Konstruktor die Kanaltypinformationen programmgesteuert anstatt mit einer Anwendungskonfigurationsdatei. Der channelType-Parameter darf keine Schnittstelle sein.

Gilt für:

ChannelFactory<TChannel>(Binding, EndpointAddress)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einer angegebenen Bindung und Endpunktadresse.

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>
Public Sub New (binding As Binding, remoteAddress As EndpointAddress)

Parameter

binding
Binding

Die Binding, die zur Konfiguration des Endpunkts verwendet wird.

remoteAddress
EndpointAddress

Die EndpointAddress, die den Speicherort des Diensts bereitstellt.

Ausnahmen

binding ist null.

Beispiele

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

Hinweise

Übergeben Sie mit diesem Konstruktor die Bindungs- und Adressinformationen programmgesteuert anstatt mit einer Anwendungskonfigurationsdatei.

Gilt für:

ChannelFactory<TChannel>(Binding, String)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse mit einer angegebenen Bindung und Remoteadresse.

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>
Public Sub New (binding As Binding, remoteAddress As String)

Parameter

binding
Binding

Die Binding, die zur Konfiguration des Endpunkts verwendet wird.

remoteAddress
String

Die Adresse, die den Speicherort des Diensts bereitstellt.

Ausnahmen

remoteAddress ist null.

Beispiele

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

Hinweise

Übergeben Sie mit diesem Konstruktor die Informationen über die Remoteadressinformationen mit einer Zeichenfolge anstatt mit einem typisierten Objekt.

Gilt für:

ChannelFactory<TChannel>(String, EndpointAddress)

Source:
ChannelFactory.cs
Source:
ChannelFactory.cs

Initialisiert eine neue Instanz der ChannelFactory<TChannel>-Klasse, die einem angegebenen Namen für die Endpunktkonfiguration und der Remoteadresse zugeordnet ist.

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)

Parameter

endpointConfigurationName
String

Der für die Endpunktkonfiguration verwendete Name.

remoteAddress
EndpointAddress

Die EndpointAddress, die den Speicherort des Diensts bereitstellt.

Ausnahmen

endpointConfigurationName oder remoteAddress ist null.

Beispiele

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

Gilt für: