共用方式為


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 狀態時才可以進行設定,因為這是唯一同時處於可變動且尚未處置的狀態。

適用於