IBindingDeliveryCapabilities 接口
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义绑定为了描述和公布客户端与服务可能需要的功能而必须实现的接口。
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 |
获取一个值,该值指示绑定是否可以支持消息的排队传递。 |