IReplyChannel.BeginReceiveRequest 方法

定義

開始非同步作業,接收可用的要求。Begins an asynchronous operation to receive an available request.

多載

BeginReceiveRequest(AsyncCallback, Object)

開始非同步作業,接收有預設逾時的可用要求。Begins an asynchronous operation to receive an available request with a default timeout.

BeginReceiveRequest(TimeSpan, AsyncCallback, Object)

開始非同步作業,接收有已指定逾時的可用要求。Begins an asynchronous operation to receive an available request with a specified timeout.

BeginReceiveRequest(AsyncCallback, Object)

開始非同步作業,接收有預設逾時的可用要求。Begins an asynchronous operation to receive an available request with a default timeout.

public:
 IAsyncResult ^ BeginReceiveRequest(AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginReceiveRequest (AsyncCallback callback, object state);
abstract member BeginReceiveRequest : AsyncCallback * obj -> IAsyncResult
Public Function BeginReceiveRequest (callback As AsyncCallback, state As Object) As IAsyncResult

參數

callback
AsyncCallback

AsyncCallback 委派,這個委派會接收要求作業完成之非同步接收的通知。The AsyncCallback delegate that receives the notification of the asynchronous receive that a request operation completes.

state
Object

應用程式所指定的物件,其中包含與要求作業之非同步接收相關聯的狀態資訊。An object, specified by the application, that contains state information associated with the asynchronous receive of a request operation.

傳回

IAsyncResult,參考要求的非同步接收。The IAsyncResult that references the asynchronous reception of the request.

範例

下列程式碼說明如何實作這個方法:The following code illustrates how to implement this method:

public IAsyncResult BeginReceiveRequest(AsyncCallback callback, object state)
{
    return BeginReceiveRequest(DefaultReceiveTimeout, callback, state);
}

備註

@No__t-0 方法會實作為非同步叫用 ReceiveRequest() 的標準模式。The BeginReceiveRequest(AsyncCallback, Object) method implements the standard pattern for invoking ReceiveRequest() asynchronously. 預設的逾時值為 1 分鐘。The default timeout is 1 minute. 如果接收逾時是設定於連線設定時所用的繫結上,則會使用該值。If a receive timeout is set on the binding used to configure the connection, then that value is used. 如果您要用會覆寫這些其他值的呼叫來指定明確的逾時,請使用BeginReceiveRequest(TimeSpan, AsyncCallback, Object)Use BeginReceiveRequest(TimeSpan, AsyncCallback, Object) if you want to specify an explicit timeout with the call that overrides these other values.

如果接收的要求訊息大於要使用繫結所允許的最大訊息大小,則會擲回 QuotaExceededExceptionIf the request message received is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. 訊息大小上限是由 MaxReceivedMessageSize 屬性所設定。The maximum message size is set by the MaxReceivedMessageSize property. 預設值為65536個位元組。The default value is 65536 bytes.

BeginReceiveRequest(TimeSpan, AsyncCallback, Object)

開始非同步作業,接收有已指定逾時的可用要求。Begins an asynchronous operation to receive an available request with a specified timeout.

public:
 IAsyncResult ^ BeginReceiveRequest(TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginReceiveRequest (TimeSpan timeout, AsyncCallback callback, object state);
abstract member BeginReceiveRequest : TimeSpan * AsyncCallback * obj -> IAsyncResult
Public Function BeginReceiveRequest (timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

參數

timeout
TimeSpan

TimeSpan,指定等候接收可用要求的時間間隔。The TimeSpan that specifies the interval of time to wait for the reception of an available request.

callback
AsyncCallback

AsyncCallback 委派,這個委派會接收要求作業完成之非同步接收的通知。The AsyncCallback delegate that receives the notification of the asynchronous receive that a request operation completes.

state
Object

應用程式所指定的物件,其中包含與要求作業之非同步接收相關聯的狀態資訊。An object, specified by the application, that contains state information associated with the asynchronous receive of a request operation.

傳回

IAsyncResult,參考要求的非同步接收。The IAsyncResult that references the asynchronous reception of the request.

範例

下列程式碼說明如何實作這個方法:The following code illustrates how to implement this method:

public IAsyncResult BeginReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
{
    ReceiveRequestAsyncResult result = new ReceiveRequestAsyncResult(this, timeout, callback, state);
    result.Begin();
    return result;
}

備註

@No__t-0 方法會實作為非同步叫用 ReceiveRequest(TimeSpan) 的標準模式。The BeginReceiveRequest(TimeSpan, AsyncCallback, Object) method implements the standard pattern for invoking ReceiveRequest(TimeSpan) asynchronously. 使用這個方法設定的逾時,將會覆寫連線設定時所使用繫結上已設定的接收逾時。The timeout set on this method overrides a receive timeout set on the binding that is used to configure the connection.

如果接收的要求訊息大於要使用繫結所允許的最大訊息大小,則會擲回 QuotaExceededExceptionIf the request message received is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. 訊息大小上限是由 MaxReceivedMessageSize 屬性所設定。The maximum message size is set by the MaxReceivedMessageSize property. 預設值為65536個位元組。The default value is 65536 bytes.

適用於