共用方式為


CustomBinding 建構函式

定義

初始化 CustomBinding 類別的新執行個體。

多載

CustomBinding()

初始化 CustomBinding 類別的新執行個體。

CustomBinding(IEnumerable<BindingElement>)

使用完整通道堆疊中的繫結項目,初始化 CustomBinding 類別的新執行個體。

CustomBinding(Binding)

從指定之繫結的值,初始化 CustomBinding 類別的新執行個體。

CustomBinding(BindingElement[])

從繫結項目的陣列初始化 CustomBinding 類別的新執行個體。

CustomBinding(String)

初始化 CustomBinding 類別的新執行個體。

CustomBinding(String, String, BindingElement[])

從具有指定之名稱和命名空間的繫結項目陣列,初始化 CustomBinding 類別的新執行個體。

CustomBinding()

來源:
CustomBinding.cs
來源:
CustomBinding.cs
來源:
CustomBinding.cs

初始化 CustomBinding 類別的新執行個體。

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

範例

下列範例示範如何使用無參數建構函式:

適用於

CustomBinding(IEnumerable<BindingElement>)

來源:
CustomBinding.cs
來源:
CustomBinding.cs
來源:
CustomBinding.cs

使用完整通道堆疊中的繫結項目,初始化 CustomBinding 類別的新執行個體。

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

參數

bindingElementsInTopDownChannelStackOrder
IEnumerable<BindingElement>

IEnumerable<T> 型別的 BindingElement,其中包含上下順序之通道堆疊的繫結項目。

例外狀況

bindingElementsInTopDownChannelStackOrdernull

範例

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)

適用於

CustomBinding(Binding)

來源:
CustomBinding.cs
來源:
CustomBinding.cs
來源:
CustomBinding.cs

從指定之繫結的值,初始化 CustomBinding 類別的新執行個體。

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)

參數

binding
Binding

用來初始化自訂繫結的 Binding

例外狀況

bindingnull

適用於

CustomBinding(BindingElement[])

來源:
CustomBinding.cs
來源:
CustomBinding.cs
來源:
CustomBinding.cs

從繫結項目的陣列初始化 CustomBinding 類別的新執行個體。

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

參數

bindingElementsInTopDownChannelStackOrder
BindingElement[]

用來初始化自訂繫結之 Array 型別的 BindingElement

例外狀況

bindingElementsInTopDownChannelStackOrdernull

範例

 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)

適用於

CustomBinding(String)

初始化 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)

參數

configurationName
String

識別 configurationName 項目的 binding 屬性值,該項目的設定會用來初始化此繫結。

例外狀況

configurationName 識別的繫結項目為 null

適用於

CustomBinding(String, String, BindingElement[])

來源:
CustomBinding.cs
來源:
CustomBinding.cs
來源:
CustomBinding.cs

從具有指定之名稱和命名空間的繫結項目陣列,初始化 CustomBinding 類別的新執行個體。

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

參數

name
String

繫結的名稱。

ns
String

繫結的命名空間。

bindingElementsInTopDownChannelStackOrder
BindingElement[]

用來初始化自訂繫結之 Array 型別的 BindingElement

例外狀況

bindingElementsInTopDownChannelStackOrdernull

範例

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)

適用於