CommunicationObject.OnClose(TimeSpan) 方法

定義

在通訊物件上插入處理 (當它因為叫用同步關閉作業而轉換到關閉狀態之後)。Inserts processing on a communication object after it transitions to the closing state due to the invocation of a synchronous close operation.

protected:
 abstract void OnClose(TimeSpan timeout);
protected abstract void OnClose (TimeSpan timeout);
abstract member OnClose : TimeSpan -> unit
Protected MustOverride Sub OnClose (timeout As TimeSpan)

參數

timeout
TimeSpan

指定必須在逾時前完成關閉作業之寬限時間的 TimeSpanThe TimeSpan that specifies how long the on close operation has to complete before timing out.

例外狀況

已針對處於 Close 狀態中的物件呼叫 FaultedClose was called on an object in the Faulted state.

已超過為作業分配的預設時間間隔,該作業未完成。The default interval of time that was allotted for the operation was exceeded before the operation was completed.

關閉物件時發生通訊錯誤。A communication error occurred while closing the object.

備註

如果通訊物件一開始處於 Close 狀態,OnClose 方法就會呼叫 OpenedThe Close method calls OnClose if the communication object is initially in the Opened state.

若要在通訊物件因為叫用非同步 BeginClose 作業而轉換至關閉狀態後插入處理,請使用 OnBeginClose 方法。To insert processing after a communication object transitions to a closing state due to the invocation of an asynchronous BeginClose operation, use the OnBeginClose method.

適用於