ChannelFactory<TChannel> Konstruktory

Definice

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

Přetížení

ChannelFactory<TChannel>()

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

ChannelFactory<TChannel>(Binding)

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

ChannelFactory<TChannel>(ServiceEndpoint)

Inicializuje novou instanci ChannelFactory<TChannel> třídy, která vytváří kanály se zadaným koncovým bodem.

ChannelFactory<TChannel>(String)

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadaným názvem konfigurace koncového bodu.

ChannelFactory<TChannel>(Type)

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

ChannelFactory<TChannel>(Binding, EndpointAddress)

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadanou vazbou a adresou koncového bodu.

ChannelFactory<TChannel>(Binding, String)

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadanou vazbou a vzdálenou adresou.

ChannelFactory<TChannel>(String, EndpointAddress)

Inicializuje novou instanci ChannelFactory<TChannel> třídy přidružené k zadanému názvu konfigurace koncového bodu a vzdálené adresy.

ChannelFactory<TChannel>()

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

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

Příklady

Tento příklad ukazuje, jak vytvořit nový objekt ChannelFactory<TChannel> třídy s rozhraním IRequestChannel .

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

Platí pro

ChannelFactory<TChannel>(Binding)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

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)

Parametry

binding
Binding

Zadaný Binding pro kanály vytvořené továrnou.

Poznámky

Tento konstruktor použijte, pokud chcete informace o vazbě předat programově místo použití konfiguračního souboru aplikace.

Platí pro

ChannelFactory<TChannel>(ServiceEndpoint)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy, která vytváří kanály se zadaným koncovým bodem.

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)

Parametry

endpoint
ServiceEndpoint

Pro ServiceEndpoint kanály vytvořené továrnou.

Výjimky

Hodnota endpoint je null.

Příklady

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

Poznámky

Tento konstruktor použijte, pokud chcete informace o koncovém bodu služby předat programově místo použití konfiguračního souboru aplikace.

Platí pro

ChannelFactory<TChannel>(String)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadaným názvem konfigurace koncového bodu.

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)

Parametry

endpointConfigurationName
String

Název konfigurace použitý pro koncový bod.

Výjimky

endpointConfigurationName je null.

Příklady

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

Poznámky

Tento konstruktor použijte, pokud je v konfiguračním souboru aplikace více než jeden cílový koncový bod.

Platí pro

ChannelFactory<TChannel>(Type)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy .

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

Parametry

channelType
Type

Kanál Type produkovaný továrnou.

Výjimky

Hodnota channelType je null.

Je channelType třída nebo typ hodnoty a není rozhraním.

Poznámky

Tento konstruktor použijte, pokud chcete předat informace o typu kanálu programově místo použití konfiguračního souboru aplikace. Parametr channelType musí být rozhraní.

Platí pro

ChannelFactory<TChannel>(Binding, EndpointAddress)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadanou vazbou a adresou koncového bodu.

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)

Parametry

binding
Binding

Slouží Binding ke konfiguraci koncového bodu.

remoteAddress
EndpointAddress

Hodnota EndpointAddress , která poskytuje umístění služby.

Výjimky

Hodnota binding je null.

Příklady

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

Poznámky

Tento konstruktor použijte, pokud chcete informace o vazbách a adresách předat programově místo použití konfiguračního souboru aplikace.

Platí pro

ChannelFactory<TChannel>(Binding, String)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy se zadanou vazbou a vzdálenou adresou.

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)

Parametry

binding
Binding

Slouží Binding ke konfiguraci koncového bodu.

remoteAddress
String

Adresa, která poskytuje umístění služby.

Výjimky

remoteAddress je null.

Příklady

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

Poznámky

Tento konstruktor použijte, pokud chcete předat informace o vzdálené adrese informace s řetězcem, nikoli jako typovaný objekt.

Platí pro

ChannelFactory<TChannel>(String, EndpointAddress)

Zdroj:
ChannelFactory.cs
Zdroj:
ChannelFactory.cs

Inicializuje novou instanci ChannelFactory<TChannel> třídy přidružené k zadanému názvu konfigurace koncového bodu a vzdálené adresy.

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)

Parametry

endpointConfigurationName
String

Název konfigurace použitý pro koncový bod.

remoteAddress
EndpointAddress

Hodnota EndpointAddress , která poskytuje umístění služby.

Výjimky

endpointConfigurationName nebo remoteAddress je null.

Příklady

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

Platí pro