BindingContext 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 BindingContext 類別的新執行個體。
多載
BindingContext(CustomBinding, BindingParameterCollection) |
為指定的繫結和繫結參數集合初始化 BindingContext 類別的執行個體。 |
BindingContext(CustomBinding, BindingParameterCollection, Uri, String, ListenUriMode) |
針對指定的繫結、繫結參數集合和服務接聽之端點的位址來初始化 BindingContext 類別的新執行個體。 |
BindingContext(CustomBinding, BindingParameterCollection)
為指定的繫結和繫結參數集合初始化 BindingContext 類別的執行個體。
public:
BindingContext(System::ServiceModel::Channels::CustomBinding ^ binding, System::ServiceModel::Channels::BindingParameterCollection ^ parameters);
public BindingContext (System.ServiceModel.Channels.CustomBinding binding, System.ServiceModel.Channels.BindingParameterCollection parameters);
new System.ServiceModel.Channels.BindingContext : System.ServiceModel.Channels.CustomBinding * System.ServiceModel.Channels.BindingParameterCollection -> System.ServiceModel.Channels.BindingContext
Public Sub New (binding As CustomBinding, parameters As BindingParameterCollection)
參數
- binding
- CustomBinding
通道的 CustomBinding。
- parameters
- BindingParameterCollection
例外狀況
binding
為 null
。
範例
CustomBinding binding = new CustomBinding();
BindingParameterCollection bpCol = new BindingParameterCollection();
BindingContext context = new BindingContext(binding, bpCol);
Dim binding As New CustomBinding()
Dim bpCol As New BindingParameterCollection()
Dim context As New BindingContext(binding, bpCol)
備註
這個建構函式將 ListenUriMode 的值設定為 Explicit,相對位址則設定為 Empty,而基底位址設定為 null
。
適用於
BindingContext(CustomBinding, BindingParameterCollection, Uri, String, ListenUriMode)
針對指定的繫結、繫結參數集合和服務接聽之端點的位址來初始化 BindingContext 類別的新執行個體。
public:
BindingContext(System::ServiceModel::Channels::CustomBinding ^ binding, System::ServiceModel::Channels::BindingParameterCollection ^ parameters, Uri ^ listenUriBaseAddress, System::String ^ listenUriRelativeAddress, System::ServiceModel::Description::ListenUriMode listenUriMode);
public BindingContext (System.ServiceModel.Channels.CustomBinding binding, System.ServiceModel.Channels.BindingParameterCollection parameters, Uri listenUriBaseAddress, string listenUriRelativeAddress, System.ServiceModel.Description.ListenUriMode listenUriMode);
new System.ServiceModel.Channels.BindingContext : System.ServiceModel.Channels.CustomBinding * System.ServiceModel.Channels.BindingParameterCollection * Uri * string * System.ServiceModel.Description.ListenUriMode -> System.ServiceModel.Channels.BindingContext
Public Sub New (binding As CustomBinding, parameters As BindingParameterCollection, listenUriBaseAddress As Uri, listenUriRelativeAddress As String, listenUriMode As ListenUriMode)
參數
- binding
- CustomBinding
通道的 CustomBinding。
- parameters
- BindingParameterCollection
- listenUriRelativeAddress
- String
服務端點接聽的相對位址。
- listenUriMode
- ListenUriMode
ListenUriMode,它會指出傳輸是否必須確定提供給服務接聽的 URI 是唯一的。
例外狀況
binding
為 null
。
範例
CustomBinding binding = new CustomBinding();
BindingParameterCollection bpCol = new BindingParameterCollection();
Uri baseAddress = new Uri("http://MyServer/Base");
string relAddress = "MyService";
BindingContext context = new BindingContext(binding, bpCol, baseAddress, relAddress, ListenUriMode.Explicit);
Dim binding As New CustomBinding()
Dim bpCol As New BindingParameterCollection()
Dim baseAddress As New Uri("http://MyServer/Base")
Dim relAddress As String = "MyService"
Dim context As New BindingContext(binding, bpCol, baseAddress, relAddress, ListenUriMode.Explicit)