BindingElement.CanBuildChannelListener<TChannel>(BindingContext) Méthode
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne une valeur qui indique si l’élément de liaison peut générer un écouteur pour un type de canal spécifique.
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
- TChannel
Type de canal accepté par l'écouteur.
- context
- BindingContext
BindingContext qui fournit le contexte pour l'élément de liaison.
true
si l'objet IChannelListener<TChannel> de type IChannel peut être généré par l'élément de liaison ; sinon, false
.
context
a la valeur null
.
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);
Utilisez la méthode pour vous assurer que l'écouteur des canaux de type TChannel
peut être généré pour l'objet context
fourni. Vous pouvez également tenter de générer l'écouteur en appelant BuildChannelListener et d'intercepter toute exception levée si la génération n'est pas possible.
Produit | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Commentaires sur .NET
.NET est un projet open source. Sélectionnez un lien pour fournir des commentaires: