Taal

BindingElement.CanBuildChannelListener<TChannel>(BindingContext) Methode

Definitie

Retourneert een waarde die aangeeft of het bindingselement een listener kan bouwen voor een specifiek type kanaal.

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

Type parameters

TChannel

Het type kanaal dat de listener accepteert.

Parameters

context
BindingContext

Het BindingContext element dat context biedt voor het bindingselement.

Retouren

trueals het IChannelListener<TChannel> type IChannel kan worden gebouwd door het bindingselement; anders. false

Uitzonderingen

context is null.

Voorbeelden

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

Opmerkingen

Gebruik deze methode als u wilt controleren of de kanaallistener voor kanalen van het type TChannel kan worden gebouwd voor de context opgegeven voordat u de listener probeert te bouwen. U kunt ook de kanaallistener bouwen door de uitzondering aan te roepen BuildChannelListener en te vangen die wordt gegenereerd als deze niet kan worden gebouwd.

Van toepassing op