BindingElement.CanBuildChannelListener<TChannel>(BindingContext) Método

Definición

Devuelve un valor que indica si el elemento de enlace puede crear un agente de escucha para un tipo específico de canal.

public:
generic <typename TChannel>
 where TChannel : class, System::ServiceModel::Channels::IChannel virtual bool CanBuildChannelListener(System::ServiceModel::Channels::BindingContext ^ context);
public virtual bool CanBuildChannelListener<TChannel>(System.ServiceModel.Channels.BindingContext context) where TChannel : class, System.ServiceModel.Channels.IChannel;
abstract member CanBuildChannelListener : System.ServiceModel.Channels.BindingContext -> bool (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
override this.CanBuildChannelListener : System.ServiceModel.Channels.BindingContext -> bool (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
Public Overridable Function CanBuildChannelListener(Of TChannel As {Class, IChannel}) (context As BindingContext) As Boolean

Parámetros de tipo

TChannel

Tipo de canal que acepta el agente de escucha.

Parámetros

context
BindingContext

BindingContext que proporciona contexto para el elemento de enlace.

Devoluciones

true es si el elemento de enlace puede generar el IChannelListener<TChannel> de tipo IChannel ; de lo contrario, falsees .

Excepciones

context es null.

Ejemplos

CustomBinding binding = new CustomBinding();
HttpTransportBindingElement element = new HttpTransportBindingElement();
BindingParameterCollection parameters = new BindingParameterCollection();
Uri baseAddress = new Uri("http://localhost:8000/ChannelApp");
String relAddress = "http://localhost:8000/ChannelApp/service";
BindingContext context = new BindingContext(binding, parameters, baseAddress, relAddress, ListenUriMode.Explicit);

bool bFlag = element.CanBuildChannelListener<IReplyChannel>(context);

Comentarios

Use este método si desea comprobar que el agente de escucha del canal para los canales de tipo TChannel se puede compilar para el context proporcionado antes de intentar compilar el agente de escucha. Como alternativa, compile el agente de escucha del canal mediante una llamada BuildChannelListener a y capture la excepción generada si no se puede compilar.

Se aplica a