ChannelDispatcher.MaxTransactedBatchSize 属性

定义

获取或设置事务处理批处理的最大大小。

public:
 property int MaxTransactedBatchSize { int get(); void set(int value); };
public int MaxTransactedBatchSize { get; set; }
member this.MaxTransactedBatchSize : int with get, set
Public Property MaxTransactedBatchSize As Integer

属性值

Int32

事务处理批处理的最大大小。

例外

设置的值小于零。

通信对象处于 OpeningOpened 状态。

通信对象处于 ClosingClosed 状态。

通信对象处于 Faulted 状态。

示例

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);

dispatcher.MaxTransactedBatchSize = 10;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

serviceHost.Open()

Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)

dispatcher.MaxTransactedBatchSize = 10

注解

只有当 MaxTransactedBatchSize 的实例处于 ChannelDispatcher 状态时才可以设置 Created 属性,因为该状态是唯一一个可变且不被释放的状态。

适用于