Поделиться через


IBindingDeliveryCapabilities Интерфейс

Определение

Определяет интерфейс, который должен быть реализован в привязках, предназначенный для описания возможностей, которые могут быть затребованы клиентами и службами, и для объявления о них.

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

Примеры

В следующем образце кода обеспечивается требование, чтобы класс CalculatorService использовал привязку WSHttpBinding с упорядоченной доставкой сообщений. По умолчанию с этой привязкой не используются надежные сеансы и доставка с формированием очереди, но эти функции можно включить.

<!-- 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, если требуется, чтобы в контрактах клиентов и служб можно было задать обязательное требование о том, чтобы привязка предоставляла необходимые им функции.

Свойства

Имя Описание
AssuresOrderedDelivery

Возвращает значение, указывающее, поддерживает ли привязка гарантии на доставку сообщений в том же порядке, в котором они отправлены.

QueuedDelivery

Возвращает значение, указывающее, поддерживает ли привязка доставку сообщений с формированием очереди.

Применяется к