CustomBinding Konstruktorer

Definition

Initierar en ny instans av CustomBinding klassen.

Överlagringar

Name Description
CustomBinding()

Initierar en ny instans av CustomBinding klassen.

CustomBinding(IEnumerable<BindingElement>)

Initierar en ny instans av CustomBinding klassen med bindningselementen från en fullständig kanalstack.

CustomBinding(Binding)

Initierar en ny instans av CustomBinding klassen från värdena för en angiven bindning.

CustomBinding(BindingElement[])

Initierar en ny instans av CustomBinding klassen från en matris med bindningselement.

CustomBinding(String)

Initierar en ny instans av CustomBinding klassen.

CustomBinding(String, String, BindingElement[])

Initierar en ny instans av CustomBinding klassen från en matris med bindningselement med ett angivet namn och namnområde.

CustomBinding()

Källa:
CustomBinding.cs
Källa:
CustomBinding.cs
Källa:
CustomBinding.cs

Initierar en ny instans av CustomBinding klassen.

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

Exempel

I följande exempel visas hur du använder den parameterlösa konstruktorn:

Gäller för

CustomBinding(IEnumerable<BindingElement>)

Källa:
CustomBinding.cs
Källa:
CustomBinding.cs
Källa:
CustomBinding.cs

Initierar en ny instans av CustomBinding klassen med bindningselementen från en fullständig kanalstack.

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

Parametrar

bindingElementsInTopDownChannelStackOrder
IEnumerable<BindingElement>

En IEnumerable<T> typ BindingElement som innehåller bindningselementen i kanalstacken uppifrån och ned.

Undantag

bindingElementsInTopDownChannelStackOrder är null.

Exempel

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)

Gäller för

CustomBinding(Binding)

Källa:
CustomBinding.cs
Källa:
CustomBinding.cs
Källa:
CustomBinding.cs

Initierar en ny instans av CustomBinding klassen från värdena för en angiven bindning.

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)

Parametrar

binding
Binding

Det Binding som används för att initiera den anpassade bindningen.

Undantag

binding är null.

Gäller för

CustomBinding(BindingElement[])

Källa:
CustomBinding.cs
Källa:
CustomBinding.cs
Källa:
CustomBinding.cs

Initierar en ny instans av CustomBinding klassen från en matris med bindningselement.

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

Parametrar

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Den Array typ BindingElement som används för att initiera den anpassade bindningen.

Undantag

bindingElementsInTopDownChannelStackOrder är null.

Exempel

 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)

Gäller för

CustomBinding(String)

Initierar en ny instans av CustomBinding klassen.

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)

Parametrar

configurationName
String

Ett värde för attributet configurationName som identifierar elementet binding vars inställningar används för att initiera bindningen.

Undantag

Bindningselementet som identifieras av configurationName är null.

Gäller för

CustomBinding(String, String, BindingElement[])

Källa:
CustomBinding.cs
Källa:
CustomBinding.cs
Källa:
CustomBinding.cs

Initierar en ny instans av CustomBinding klassen från en matris med bindningselement med ett angivet namn och namnområde.

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

Parametrar

name
String

Namnet på bindningen.

ns
String

Bindningens namnområde.

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Den Array typ BindingElement som används för att initiera den anpassade bindningen.

Undantag

bindingElementsInTopDownChannelStackOrder är null.

Exempel

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)

Gäller för