IInputChannel 介面

定義

定義通道必須實作以接收訊息的介面。Defines the interface that a channel must implement to receive a message.

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

備註

重要

呼叫實作此介面之類別的方法時,若並用了不信任的資料,會造成安全性上的風險。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.

IInputChannel 合約包括接收、嘗試接收 (try-to-receive) 和等候訊息 (wait-for-a-message) 功能的同步和非同步等變體。The IInputChannel contract includes synchronous and asynchronous variants of receive, try-to-receive and wait-for-a-message functionality.

提取模型一般是配合 IInputChannel 使用來接收訊息:您要呼叫 Receive (從通道「提取」訊息) 然後等候訊息到達。The pull model is used typically with an IInputChannel to receive messages: you call Receive (to "pull" a message out of the channel) and then wait for a message to arrive. 另一個替代的使用模式是呼叫 BeginWaitForMessage(TimeSpan, AsyncCallback, Object) 或者 BeginWaitForMessage(TimeSpan, AsyncCallback, Object),然後呼叫 Receive(TimeSpan)An alternative usage pattern is to call BeginWaitForMessage(TimeSpan, AsyncCallback, Object) or BeginWaitForMessage(TimeSpan, AsyncCallback, Object), and then call Receive(TimeSpan). 對於在 WaitForMessage(TimeSpan)Receive 呼叫之間開始異動的異動用法而言,這是很常見的方法。This approach is common for transactional usages where you start the transaction between the calls to WaitForMessage(TimeSpan) and Receive.

IInputChannel 不一定要繫結到單一寄件人。An IInputChannel is not necessarily bound to a single sender. 其他的通道和通道介面可以提供特定寄件人和 IInputChannel之間的相互關聯,但是基底合約並未提供這類限制。Other channels and channel interfaces can provide a correlation between particular senders and an IInputChannel, but the base contract makes no such restriction. 實作 (Implementation) 可以為每個訊息建立新的 IInputChannel,或者為多個訊息和寄件人重複使用相同的 IInputChannelAn implementation can create a new IInputChannel for each message or reuse the same IInputChannel for multiple messages and senders.

屬性

LocalAddress

取得輸入通道接收訊息的位址。Gets the address on which the input channel receives messages.

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)
BeginReceive(AsyncCallback, Object)

開始非同步的作業,接收具有與該作業關聯之狀態物件的訊息。Begins an asynchronous operation to receive a message that has a state object associated with it.

BeginReceive(TimeSpan, AsyncCallback, Object)

開始非同步的作業,接收具有已指定逾時以及與該作業關聯之狀態物件的訊息。Begins an asynchronous operation to receive a message that has a specified time out and state object associated with it.

BeginTryReceive(TimeSpan, AsyncCallback, Object)

開始非同步的作業,接收具有已指定逾時以及與該作業關聯之狀態物件的訊息。Begins an asynchronous operation to receive a message that has a specified time out and state object associated with it.

BeginWaitForMessage(TimeSpan, AsyncCallback, Object)

開始非同步的「等候訊息到達」(wait-for-a-message-to-arrive) 作業,這個作業具有指定的逾時以及與該作業關聯之狀態物件。Begins an asynchronous wait-for-a-message-to-arrive operation that has a specified time out and state object associated with it.

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)
EndReceive(IAsyncResult)

完成非同步作業,以便接收訊息。Completes an asynchronous operation to receive a message.

EndTryReceive(IAsyncResult, Message)

完成指定的非同步作業,以便接收訊息。Completes the specified asynchronous operation to receive a message.

EndWaitForMessage(IAsyncResult)

完成指定的非同步「等候訊息」(wait-for-a-message) 作業。Completes the specified asynchronous wait-for-a-message operation.

GetProperty<T>()

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

(繼承來源 IChannel)
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)
Receive()

如果有收到訊息,則將該訊息傳回。Returns the message received, if one is available. 如果沒有收到訊息,執行緒就會封鎖一段預設間隔時間。If a message is not available, blocks for a default interval of time.

Receive(TimeSpan)

如果有收到訊息,則將該訊息傳回。Returns the message received, if one is available. 如果沒有收到訊息,執行緒就會封鎖一段指定的間隔時間。If a message is not available, blocks for a specified interval of time.

TryReceive(TimeSpan, Message)

嘗試在指定的時間間隔內接收訊息。Tries to receive a message within a specified interval of time.

WaitForMessage(TimeSpan)

傳回值,這個值會表示訊息是否是在指定的時間間隔內到達。Returns a value that indicates whether a message has arrived within a specified interval of time.

事件

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)

適用於