ChannelFactory<TChannel>.CreateChannel Метод
Определение
Создает канал заданного типа, связанный с заданным адресом конечной точки.Creates a channel of a specified type to a specified endpoint address.
Перегрузки
CreateChannel(Binding, EndpointAddress, Uri) |
Создает канал заданного типа, используемый для отправки сообщений в настраиваемую с помощью указанной привязки конечную точку службы по заданному адресу транспортировки.Creates a channel of a specified type that is used to send messages to a service endpoint at a specified transport address that is configured with a specified binding. |
CreateChannel(Binding, EndpointAddress) |
Создает канал заданного типа, используемый для отправки сообщений в конечную точку службы, настраиваемую с помощью указанной привязки.Creates a channel of a specified type that is used to send messages to a service endpoint that is configured with a specified binding. |
CreateChannel(EndpointAddress, Uri) |
Создает канал, используемый для отправки сообщений в службу по конкретному адресу конечной точки через указанный адрес транспортировки.Creates a channel that is used to send messages to a service at a specific endpoint address through a specified transport address. |
CreateChannel(EndpointAddress) |
Создает канал, используемый для отправки сообщений в службу по конкретному адресу конечной точки.Creates a channel that is used to send messages to a service at a specific endpoint address. |
CreateChannel() |
Создает канал заданного типа, связанный с заданным адресом конечной точки.Creates a channel of a specified type to a specified endpoint address. |
CreateChannel(String) |
Создает канал, используемый для отправки сообщений в службу, конечная точка которой настраивается заданным способом.Creates a channel that is used to send messages to a service whose endpoint is configured in a specified way. |
Комментарии
Создает канал типа TChannel
, общий параметр для класса.Creates a channel of type TChannel
, the generic parameter for the class.
CreateChannel(Binding, EndpointAddress, Uri)
Создает канал заданного типа, используемый для отправки сообщений в настраиваемую с помощью указанной привязки конечную точку службы по заданному адресу транспортировки.Creates a channel of a specified type that is used to send messages to a service endpoint at a specified transport address that is configured with a specified binding.
public:
static TChannel CreateChannel(System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ address, Uri ^ via);
public static TChannel CreateChannel (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address, Uri via);
static member CreateChannel : System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress * Uri -> 'Channel
Параметры
- binding
- Binding
Объект Binding, используемый для настройки конечной точки.The Binding used to configure the endpoint.
- endpointAddress
- EndpointAddress
Объект EndpointAddress, предоставляющий расположение службы.The EndpointAddress that provides the location of the service.
- via
- Uri
Код Uri, содержащий адрес транспортировки, по которому канал отправляет сообщения.The Uri that contains the transport address to which the channel sends messages.
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Исключения
Объект ChannelFactory имеет дуплексные операции, которые он не поддерживает.The ChannelFactory has duplex operations it does not support.
Примеры
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
Uri uri = new Uri("http://localhost:8000/Via");
IRequestChannel channel =
ChannelFactory<IRequestChannel>.CreateChannel(binding, address, uri);
channel.Open();
class Program : ChannelFactory<IService1Channel>
{
static void Main(string[] args)
{
IService1Channel channel = CreateChannel("BasicHttpBinding_IService1");
channel.Open();
channel.Close();
}
}
CreateChannel(Binding, EndpointAddress)
Создает канал заданного типа, используемый для отправки сообщений в конечную точку службы, настраиваемую с помощью указанной привязки.Creates a channel of a specified type that is used to send messages to a service endpoint that is configured with a specified binding.
public:
static TChannel CreateChannel(System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ address);
public static TChannel CreateChannel (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address);
static member CreateChannel : System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> 'Channel
Параметры
- binding
- Binding
Объект Binding, используемый для настройки конечной точки.The Binding used to configure the endpoint.
- endpointAddress
- EndpointAddress
Объект EndpointAddress, предоставляющий расположение службы.The EndpointAddress that provides the location of the service.
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Исключения
Объект ChannelFactory имеет дуплексные операции, которые он не поддерживает.The ChannelFactory has duplex operations it does not support.
Примеры
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
IRequestChannel channel = ChannelFactory<IRequestChannel>.CreateChannel(binding, address);
channel.Open();
CreateChannel(EndpointAddress, Uri)
Создает канал, используемый для отправки сообщений в службу по конкретному адресу конечной точки через указанный адрес транспортировки.Creates a channel that is used to send messages to a service at a specific endpoint address through a specified transport address.
public:
virtual TChannel CreateChannel(System::ServiceModel::EndpointAddress ^ address, Uri ^ via);
public virtual TChannel CreateChannel (System.ServiceModel.EndpointAddress address, Uri via);
abstract member CreateChannel : System.ServiceModel.EndpointAddress * Uri -> 'Channel
override this.CreateChannel : System.ServiceModel.EndpointAddress * Uri -> 'Channel
Public Overridable Function CreateChannel (address As EndpointAddress, via As Uri) As TChannel
Параметры
- address
- EndpointAddress
Объект EndpointAddress, предоставляющий расположение службы.The EndpointAddress that provides the location of the service.
- via
- Uri
Код Uri, содержащий адрес транспортировки, по которому канал отправляет сообщения.The Uri that contains the transport address to which the channel sends messages.
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Реализации
Исключения
Свойство address
имеет значение null
.address
is null
.
Объект ChannelFactory имеет дуплексные операции, которые он не поддерживает.The ChannelFactory has duplex operations it does not support.
Примеры
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);
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();
CreateChannel(EndpointAddress)
Создает канал, используемый для отправки сообщений в службу по конкретному адресу конечной точки.Creates a channel that is used to send messages to a service at a specific endpoint address.
public:
virtual TChannel CreateChannel(System::ServiceModel::EndpointAddress ^ address);
public TChannel CreateChannel (System.ServiceModel.EndpointAddress address);
abstract member CreateChannel : System.ServiceModel.EndpointAddress -> 'Channel
override this.CreateChannel : System.ServiceModel.EndpointAddress -> 'Channel
Public Function CreateChannel (address As EndpointAddress) As TChannel
Параметры
- address
- EndpointAddress
Объект EndpointAddress, предоставляющий расположение службы.The EndpointAddress that provides the location of the service.
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Реализации
Исключения
Свойство address
имеет значение null
.address
is null
.
Примеры
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(binding);
factory.CreateChannel(address);
CreateChannel()
Создает канал заданного типа, связанный с заданным адресом конечной точки.Creates a channel of a specified type to a specified endpoint address.
public:
TChannel CreateChannel();
public TChannel CreateChannel ();
member this.CreateChannel : unit -> 'Channel
Public Function CreateChannel () As TChannel
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Примеры
IChannelFactory<IRequestChannel> factory = binding.BuildChannelFactory<IRequestChannel>(bindingParams);
factory.Open();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
IRequestChannel channel = factory.CreateChannel(address);
channel.Open();
Комментарии
Создает канал типа TChannel
, общий параметр для класса.Creates a channel of type TChannel
, the generic parameter for the class.
CreateChannel(String)
Создает канал, используемый для отправки сообщений в службу, конечная точка которой настраивается заданным способом.Creates a channel that is used to send messages to a service whose endpoint is configured in a specified way.
protected:
static TChannel CreateChannel(System::String ^ endpointConfigurationName);
protected static TChannel CreateChannel (string endpointConfigurationName);
static member CreateChannel : string -> 'Channel
Protected Shared Function CreateChannel (endpointConfigurationName As String) As TChannel
Параметры
- endpointConfigurationName
- String
Имя используемой для службы конфигурации конечной точки.The name of the endpoint configuration used for the service.
Возвраты
Канал TChannel
типа IChannel, созданный фабрикой.The TChannel
of type IChannel created by the factory.
Исключения
Объект ChannelFactory имеет дуплексные операции, которые он не поддерживает.The ChannelFactory has duplex operations it does not support.
Примеры
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory =
new ChannelFactory<IRequestChannel>(binding, address);
IRequestChannel channel = factory.CreateChannel();
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();
}