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 方法 ICommunicationObjectGetProperty 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)

适用于