IChannel 介面

定義

定義所有通道物件都必須實作的基本介面。Defines the basic interface that all channel objects must implement. 它會要求這些物件實作所有通訊物件所共用的狀態機器介面,並要求這些物件實作一個方法來從通道堆疊擷取物件。It requires that they implement the state machine interface shared by all communication objects and that they implement a method to retrieve objects from the channel stack.

public interface class IChannel : System::ServiceModel::ICommunicationObject
public interface IChannel : System.ServiceModel.ICommunicationObject
type IChannel = interface
    interface ICommunicationObject
Public Interface IChannel
Implements ICommunicationObject
衍生
實作

備註

重要

呼叫實作此介面之類別的方法時,若並用了不信任的資料,會造成安全性上的風險。Calling methods from classes that implement this interface with untrusted data is a security risk. 呼叫實作此介面之類別的方法時,請一律使用信任的資料。Call the methods from classes that implement this interface only with trusted data. 如需詳細資訊,請參閱資料驗證For more information, see Data Validation.

通道必須滿足 ICommunicationObject 介面所定義之狀態機器的合約。Channels must satisfy the contract of a state machine as defined by the ICommunicationObject interface.

IChannel 介面會將The IChannel interface adds the

GetProperty 方法新增至 ICommunicationObject 介面中。GetProperty method to the ICommunicationObject interface. 這個方法會提供從通道堆疊擷取屬性的機制,不管這些屬性位於堆疊中的何處。This method provides a mechanism for retrieving properties from the channel stack regardless of where in the stack those properties live. 方法名稱中的「屬性」一詞指的是屬於堆疊內其中一個通道的資訊片段。The term "property" in the method name refers to a piece of information that belongs to one of the channels in the stack. 該屬性的 CLR 型別是由 T 所決定。The CLR type for that property is determined by T. 這個擷取方法也會在通道處理站和通道接聽程式上使用。This method of retrieval is also used on channel factories and channel listeners.

IChannel 會由與基本訊息交換模式相關的每一個通道介面所繼承:IChannel is inherited by each of the channel interfaces associated with the basic message-exchange patterns:

屬性

State

取得通訊導向物件的目前狀態。Gets the current state of the communication-oriented object.

(繼承來源 ICommunicationObject)

方法

Abort()

導致通訊物件立即從目前的狀態轉換為已關閉狀態。Causes a communication object to transition immediately from its current state into the closed state.

(繼承來源 ICommunicationObject)
BeginClose(AsyncCallback, Object)

開始非同步作業以關閉通訊物件。Begins an asynchronous operation to close a communication object.

(繼承來源 ICommunicationObject)
BeginClose(TimeSpan, AsyncCallback, Object)

開始非同步作業,關閉有已指定逾時的通訊物件。Begins an asynchronous operation to close a communication object with a specified timeout.

(繼承來源 ICommunicationObject)
BeginOpen(AsyncCallback, Object)

開始非同步作業以開啟通訊物件。Begins an asynchronous operation to open a communication object.

(繼承來源 ICommunicationObject)
BeginOpen(TimeSpan, AsyncCallback, Object)

開始非同步作業,開啟有已指定時間間隔的通訊物件。Begins an asynchronous operation to open a communication object within a specified interval of time.

(繼承來源 ICommunicationObject)
Close()

導致通訊物件從目前的狀態轉換為已關閉狀態。Causes a communication object to transition from its current state into the closed state.

(繼承來源 ICommunicationObject)
Close(TimeSpan)

導致通訊物件從目前的狀態轉換為已關閉狀態。Causes a communication object to transition from its current state into the closed state.

(繼承來源 ICommunicationObject)
EndClose(IAsyncResult)

完成非同步作業以關閉通訊物件。Completes an asynchronous operation to close a communication object.

(繼承來源 ICommunicationObject)
EndOpen(IAsyncResult)

完成非同步作業以開啟通訊物件。Completes an asynchronous operation to open a communication object.

(繼承來源 ICommunicationObject)
GetProperty<T>()

從通道堆疊的適當層次中,傳回要求的型別物件 (如果有)。Returns a typed object requested, if present, from the appropriate layer in the channel stack.

Open()

導致通訊物件從已建立狀態轉換為已開啟狀態。Causes a communication object to transition from the created state into the opened state.

(繼承來源 ICommunicationObject)
Open(TimeSpan)

在指定時間間隔內,讓通訊物件從已建立狀態轉換為已開啟狀態。Causes a communication object to transition from the created state into the opened state within a specified interval of time.

(繼承來源 ICommunicationObject)

事件

Closed

當通訊物件從關閉中狀態轉換為已關閉狀態完成時發生。Occurs when the communication object completes its transition from the closing state into the closed state.

(繼承來源 ICommunicationObject)
Closing

當通訊物件第一次進入關閉中狀態時發生。Occurs when the communication object first enters the closing state.

(繼承來源 ICommunicationObject)
Faulted

當通訊物件第一次進入錯誤狀態時發生。Occurs when the communication object first enters the faulted state.

(繼承來源 ICommunicationObject)
Opened

當通訊物件從開啟中狀態轉換為已開啟狀態結束時發生。Occurs when the communication object completes its transition from the opening state into the opened state.

(繼承來源 ICommunicationObject)
Opening

當通訊物件第一次進入開啟中狀態時發生。Occurs when the communication object first enters the opening state.

(繼承來源 ICommunicationObject)

適用於