Partager via


CustomBinding Constructeurs

Définition

Initialise une nouvelle instance de la classe CustomBinding.

Surcharges

CustomBinding()

Initialise une nouvelle instance de la classe CustomBinding.

CustomBinding(IEnumerable<BindingElement>)

Initialise une nouvelle instance de la classe CustomBinding avec les éléments de liaison d'une pile de canaux complète.

CustomBinding(Binding)

Initialise une nouvelle instance de la classe CustomBinding à partir des valeurs d'une liaison spécifiée.

CustomBinding(BindingElement[])

Initialise une nouvelle instance de la classe CustomBinding à partir d'un tableau d'éléments de liaison.

CustomBinding(String)

Initialise une nouvelle instance de la classe CustomBinding.

CustomBinding(String, String, BindingElement[])

Initialise une nouvelle instance de la classe CustomBinding à partir d'un tableau d'éléments de liaison avec un nom et un espace de noms spécifiés.

CustomBinding()

Source:
CustomBinding.cs
Source:
CustomBinding.cs
Source:
CustomBinding.cs

Initialise une nouvelle instance de la classe CustomBinding.

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

Exemples

L’exemple suivant montre comment utiliser le constructeur sans paramètre :

S’applique à

CustomBinding(IEnumerable<BindingElement>)

Source:
CustomBinding.cs
Source:
CustomBinding.cs
Source:
CustomBinding.cs

Initialise une nouvelle instance de la classe CustomBinding avec les éléments de liaison d'une pile de canaux complète.

public:
 CustomBinding(System::Collections::Generic::IEnumerable<System::ServiceModel::Channels::BindingElement ^> ^ bindingElementsInTopDownChannelStackOrder);
public CustomBinding (System.Collections.Generic.IEnumerable<System.ServiceModel.Channels.BindingElement> bindingElementsInTopDownChannelStackOrder);
new System.ServiceModel.Channels.CustomBinding : seq<System.ServiceModel.Channels.BindingElement> -> System.ServiceModel.Channels.CustomBinding
Public Sub New (bindingElementsInTopDownChannelStackOrder As IEnumerable(Of BindingElement))

Paramètres

bindingElementsInTopDownChannelStackOrder
IEnumerable<BindingElement>

IEnumerable<T> de type BindingElement qui contient les éléments de liaison de la pile de canaux dans un ordre décroissant.

Exceptions

bindingElementsInTopDownChannelStackOrder a la valeur null.

Exemples

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

// Create a custom binding that contains two binding elements.
ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
reliableSession.Ordered = true;

HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

SynchronizedCollection<BindingElement> coll = new SynchronizedCollection<BindingElement>();
coll.Add(reliableSession);
coll.Add(httpTransport);

CustomBinding binding = new CustomBinding(coll);
Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

' Create a custom binding that contains two binding elements.
Dim reliableSession As New ReliableSessionBindingElement()
reliableSession.Ordered = True

Dim httpTransport As New HttpTransportBindingElement()
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard

Dim coll As New SynchronizedCollection(Of BindingElement)()
coll.Add(reliableSession)
coll.Add(httpTransport)

Dim binding As New CustomBinding(coll)

S’applique à

CustomBinding(Binding)

Source:
CustomBinding.cs
Source:
CustomBinding.cs
Source:
CustomBinding.cs

Initialise une nouvelle instance de la classe CustomBinding à partir des valeurs d'une liaison spécifiée.

public:
 CustomBinding(System::ServiceModel::Channels::Binding ^ binding);
public CustomBinding (System.ServiceModel.Channels.Binding binding);
new System.ServiceModel.Channels.CustomBinding : System.ServiceModel.Channels.Binding -> System.ServiceModel.Channels.CustomBinding
Public Sub New (binding As Binding)

Paramètres

binding
Binding

Binding utilisé pour initialiser la liaison personnalisée.

Exceptions

binding a la valeur null.

S’applique à

CustomBinding(BindingElement[])

Source:
CustomBinding.cs
Source:
CustomBinding.cs
Source:
CustomBinding.cs

Initialise une nouvelle instance de la classe CustomBinding à partir d'un tableau d'éléments de liaison.

public:
 CustomBinding(... cli::array <System::ServiceModel::Channels::BindingElement ^> ^ bindingElementsInTopDownChannelStackOrder);
public CustomBinding (params System.ServiceModel.Channels.BindingElement[] bindingElementsInTopDownChannelStackOrder);
new System.ServiceModel.Channels.CustomBinding : System.ServiceModel.Channels.BindingElement[] -> System.ServiceModel.Channels.CustomBinding
Public Sub New (ParamArray bindingElementsInTopDownChannelStackOrder As BindingElement())

Paramètres

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Array de type BindingElement utilisé pour initialiser la liaison personnalisée.

Exceptions

bindingElementsInTopDownChannelStackOrder a la valeur null.

Exemples

 Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
 ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

// Create a custom binding that contains two binding elements.
ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
reliableSession.Ordered = true;

HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

BindingElement[] elements = new BindingElement[2];
elements[0] = reliableSession;
elements[1] = httpTransport;

CustomBinding binding = new CustomBinding(elements);
 Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")

' Create a ServiceHost for the CalculatorService type and provide the base address.
 Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

' Create a custom binding that contains two binding elements.
Dim reliableSession As New ReliableSessionBindingElement()
reliableSession.Ordered = True

Dim httpTransport As New HttpTransportBindingElement()
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard

Dim elements(1) As BindingElement
elements(0) = reliableSession
elements(1) = httpTransport

Dim binding As New CustomBinding(elements)

S’applique à

CustomBinding(String)

Initialise une nouvelle instance de la classe CustomBinding.

public:
 CustomBinding(System::String ^ configurationName);
public CustomBinding (string configurationName);
new System.ServiceModel.Channels.CustomBinding : string -> System.ServiceModel.Channels.CustomBinding
Public Sub New (configurationName As String)

Paramètres

configurationName
String

Valeur de l'attribut configurationName qui identifie l'élément binding dont les paramètres sont utilisés pour initialiser la liaison.

Exceptions

L'élément de liaison identifié par le configurationName a la valeur null.

S’applique à

CustomBinding(String, String, BindingElement[])

Source:
CustomBinding.cs
Source:
CustomBinding.cs
Source:
CustomBinding.cs

Initialise une nouvelle instance de la classe CustomBinding à partir d'un tableau d'éléments de liaison avec un nom et un espace de noms spécifiés.

public:
 CustomBinding(System::String ^ name, System::String ^ ns, ... cli::array <System::ServiceModel::Channels::BindingElement ^> ^ bindingElementsInTopDownChannelStackOrder);
public CustomBinding (string name, string ns, params System.ServiceModel.Channels.BindingElement[] bindingElementsInTopDownChannelStackOrder);
new System.ServiceModel.Channels.CustomBinding : string * string * System.ServiceModel.Channels.BindingElement[] -> System.ServiceModel.Channels.CustomBinding
Public Sub New (name As String, ns As String, ParamArray bindingElementsInTopDownChannelStackOrder As BindingElement())

Paramètres

name
String

Le nom de la liaison.

ns
String

Espace de noms de la liaison.

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Array de type BindingElement utilisé pour initialiser la liaison personnalisée.

Exceptions

bindingElementsInTopDownChannelStackOrder a la valeur null.

Exemples

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

// Create a custom binding that contains two binding elements.
ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
reliableSession.Ordered = true;

HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

BindingElement[] elements = new BindingElement[2];
elements[0] = reliableSession;
elements[1] = httpTransport;

CustomBinding binding = new CustomBinding("MyCustomBinding", "http://localhost/service", elements);
Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

' Create a custom binding that contains two binding elements.
Dim reliableSession As New ReliableSessionBindingElement()
reliableSession.Ordered = True

Dim httpTransport As New HttpTransportBindingElement()
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard

Dim elements(1) As BindingElement
elements(0) = reliableSession
elements(1) = httpTransport

Dim binding As New CustomBinding("MyCustomBinding", "http://localhost/service", elements)

S’applique à