共用方式為


ChannelDispatcher.IsTransactedReceive 屬性

定義

取得值,這個值會指出是否已在異動中對接聽程式呼叫「接收」方法。

public:
 property bool IsTransactedReceive { bool get(); void set(bool value); };
public bool IsTransactedReceive { get; set; }
member this.IsTransactedReceive : bool with get, set
Public Property IsTransactedReceive As Boolean

屬性值

Boolean

如果已在交易中對接聽程式呼叫「接收」方法,則為 true,否則為 false

例外狀況

通訊物件處於 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);
bool isTransactedReceive = dispatcher.IsTransactedReceive;
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)
Dim isTransactedReceive As Boolean = dispatcher.IsTransactedReceive

備註

IsTransactedReceive 屬性只有在 ChannelDispatcher 的執行個體處於 Created 狀態時才可以進行設定,因為這是唯一同時處於可變動且尚未處置的狀態。

適用於