Bagikan melalui


CustomBinding Konstruktor

Definisi

Menginisialisasi instans baru kelas CustomBinding.

Overload

CustomBinding()

Menginisialisasi instans baru kelas CustomBinding.

CustomBinding(IEnumerable<BindingElement>)

Menginisialisasi instans CustomBinding baru kelas dengan elemen pengikatan dari tumpukan saluran lengkap.

CustomBinding(Binding)

Menginisialisasi instans CustomBinding baru kelas dari nilai pengikatan tertentu.

CustomBinding(BindingElement[])

Menginisialisasi instans CustomBinding baru kelas dari array elemen pengikatan.

CustomBinding(String)

Menginisialisasi instans baru kelas CustomBinding.

CustomBinding(String, String, BindingElement[])

Menginisialisasi instans CustomBinding baru kelas dari array elemen pengikatan dengan nama dan namespace yang ditentukan.

CustomBinding()

Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs

Menginisialisasi instans baru kelas CustomBinding.

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

Contoh

Contoh berikut menunjukkan cara menggunakan konstruktor tanpa parameter:

Berlaku untuk

CustomBinding(IEnumerable<BindingElement>)

Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs

Menginisialisasi instans CustomBinding baru kelas dengan elemen pengikatan dari tumpukan saluran lengkap.

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

Parameter

bindingElementsInTopDownChannelStackOrder
IEnumerable<BindingElement>

IEnumerable<T> Jenis BindingElement yang berisi elemen pengikatan tumpukan saluran dalam urutan atas ke bawah.

Pengecualian

bindingElementsInTopDownChannelStackOrderadalah null.

Contoh

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)

Berlaku untuk

CustomBinding(Binding)

Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs

Menginisialisasi instans CustomBinding baru kelas dari nilai pengikatan tertentu.

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)

Parameter

binding
Binding

Binding yang digunakan untuk menginisialisasi pengikatan kustom.

Pengecualian

bindingadalah null.

Berlaku untuk

CustomBinding(BindingElement[])

Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs

Menginisialisasi instans CustomBinding baru kelas dari array elemen pengikatan.

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

Parameter

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Array Jenis yang BindingElement digunakan untuk menginisialisasi pengikatan kustom.

Pengecualian

bindingElementsInTopDownChannelStackOrderadalah null.

Contoh

 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)

Berlaku untuk

CustomBinding(String)

Menginisialisasi instans baru kelas 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)

Parameter

configurationName
String

Nilai configurationName atribut yang mengidentifikasi binding elemen yang pengaturannya digunakan untuk menginisialisasi pengikatan.

Pengecualian

Elemen pengikatan yang diidentifikasi oleh configurationName adalah null.

Berlaku untuk

CustomBinding(String, String, BindingElement[])

Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs
Sumber:
CustomBinding.cs

Menginisialisasi instans CustomBinding baru kelas dari array elemen pengikatan dengan nama dan namespace yang ditentukan.

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

Parameter

name
String

Nama pengikatan.

ns
String

Namespace pengikatan.

bindingElementsInTopDownChannelStackOrder
BindingElement[]

Array Jenis yang BindingElement digunakan untuk menginisialisasi pengikatan kustom.

Pengecualian

bindingElementsInTopDownChannelStackOrderadalah null.

Contoh

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)

Berlaku untuk