IBindingDeliveryCapabilities 介面

定義

定義繫結必須實作的介面,以描述及通告用戶端和服務可能需要的功能。Defines the interface that bindings must implement to describe and advertise the capabilities that clients and services may require.

public interface class IBindingDeliveryCapabilities
public interface IBindingDeliveryCapabilities
type IBindingDeliveryCapabilities = interface
Public Interface IBindingDeliveryCapabilities

範例

下列範例會要求 CalculatorService 必須使用 WSHttpBinding,並以排序的方式傳遞訊息。The following sample requires that CalculatorService must use a WSHttpBinding with ordered message delivery. 在預設情況下,可靠的工作階段和佇列傳遞不會搭配這個繫結一起使用,但是可加以啟用。Reliable sessions and queued delivery are not used by default with this binding, but can be enabled.

<!-- Here is the configuration for a CalculatorService using a WSHttpBinding with ordered message delivery required. -->  
<?xml version="1.0" encoding="utf-8" ?>  
<configuration>  
   <system.serviceModel>  
      <services>  
         <service   
             type="Microsoft.ServiceModel.Samples.CalculatorService">  
            <!-- Use base address provided by host and a WSHttpBinding named "Binding1" -->  
            <endpoint address=""  
                      binding="wsHttpBinding"  
                      bindingConfiguration="Binding1"   
                      contract="Microsoft.ServiceModel.Samples.ICalculator" />  
         </service>  
      </services>  
  
      <bindings>  
         <wsHttpBinding>   
            <binding name="Binding1">           
               <!-- The next element enables a ReliableSession and required ordered delivery-->  
      <reliableSession enabled="true" ordered="true"/>  
      </binding>  
         </wsHttpBinding>  
      </bindings>  
  
   </system.serviceModel>  
</configuration>  
  
// The CalculatorService configuration has enabled a reliable session  
// with ordered delivery set to true. This means that the binding  
// requirement for ordered delivery specified by the  
// BindingRequirementsAttribute on the CalculatorService class  
// implemented below will be satisfied by this WSHttpBinding.  
  
using System;  
using System.ServiceModel;  
  
[ServiceContract]  
interface ICalculatorService  
{  
  [OperationBehavior()]  
  int Add(int a, int b);    
  
  [OperationContract]  
  int Subtract(int a, int b);  
}  
  
[BindingRequirements(  
  QueuedDeliveryRequirements=RequirementsMode.Disallow,  
  RequireOrderedDelivery=true  
)]  
class CalculatorService: ICalculatorService  
{  
  public int Add(int a, int b)  
  {  
    Console.WriteLine("Add called.");  
    return a + b;   
  }  
  
  public int Subtract(int a, int b)  
  {  
    Console.WriteLine("Subtract called.");  
    return a - b;  
  }  
  
  public int Multiply(int a, int b)  
  {  
    return a * b;  
  }  
}  

備註

如果用戶端和服務能夠在其合約中保證,它們所需的功能是由繫結所提供,則此繫結就必須實作 IBindingDeliveryCapabilities 介面。The IBindingDeliveryCapabilities interface must be implemented by a binding if clients and services are to be able to stipulate, as part of their contract, that the features they require are provided by the binding.

屬性

AssuresOrderedDelivery

取得值,這個值指出繫結是否可以支援保證能夠以訊息傳送的順序來傳遞訊息。Gets a value that indicates whether the binding can support assurances for the delivery of messages in the order they were sent.

QueuedDelivery

取得值,這個值指出繫結是否可以支援佇列訊息傳遞。Gets a value that indicates whether the binding can support the queued delivery of messages.

適用於