IReplyChannel.ReceiveRequest 方法

定義

如果有收到可用的要求,則將該要求的內容傳回。Returns the context of the request received, if one is available.

多載

ReceiveRequest()

如果有收到可用的要求,則將該要求的內容傳回。Returns the context of the request received, if one is available. 如果無法取得內容,請等候直到有可用內容為止。If a context is not available, waits until there is one available.

ReceiveRequest(TimeSpan)

如果有收到可用的要求,則將該要求的內容傳回。Returns the context of the request received, if one is available. 如果無法取得內容,請等候直到有可用內容為止。If a context is not available, waits until there is one available.

ReceiveRequest()

如果有收到可用的要求,則將該要求的內容傳回。Returns the context of the request received, if one is available. 如果無法取得內容,請等候直到有可用內容為止。If a context is not available, waits until there is one available.

public:
 System::ServiceModel::Channels::RequestContext ^ ReceiveRequest();
public System.ServiceModel.Channels.RequestContext ReceiveRequest ();
abstract member ReceiveRequest : unit -> System.ServiceModel.Channels.RequestContext
Public Function ReceiveRequest () As RequestContext

傳回

RequestContext,用來建構回覆。The RequestContext used to construct replies.

範例

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

public RequestContext ReceiveRequest()
{
    return ReceiveRequest(DefaultReceiveTimeout);
}

備註

RequestContext,封裝要求訊息和回覆該訊息的機制。RequestContext encapsulates the request message and a mechanism for replying to that message.

ReceiveRequest 可以多次呼叫或同時呼叫。ReceiveRequest can be called multiple times or concurrently. 每個接收要求只會完成一次 ReceiveRequest 呼叫。Only one ReceiveRequest call completes per request received.

如果接收的要求訊息大於要使用繫結所允許的最大訊息大小,則會擲回 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.

ReceiveRequest(TimeSpan)

如果有收到可用的要求,則將該要求的內容傳回。Returns the context of the request received, if one is available. 如果無法取得內容,請等候直到有可用內容為止。If a context is not available, waits until there is one available.

public:
 System::ServiceModel::Channels::RequestContext ^ ReceiveRequest(TimeSpan timeout);
public System.ServiceModel.Channels.RequestContext ReceiveRequest (TimeSpan timeout);
abstract member ReceiveRequest : TimeSpan -> System.ServiceModel.Channels.RequestContext
Public Function ReceiveRequest (timeout As TimeSpan) As RequestContext

參數

timeout
TimeSpan

TimeSpan,指定必須在逾時和傳回 false 多久之前完成接收要求作業。The TimeSpan that specifies how long the receive of a request operation has to complete before timing out and returning false.

傳回

RequestContext,用來建構回覆。The RequestContext used to construct replies.

範例

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

public RequestContext ReceiveRequest(TimeSpan timeout)
{
    RequestContext requestContext;
    while (true)
    {
        requestContext = this.InnerChannel.ReceiveRequest(timeout);
        if (ProcessRequestContext(ref requestContext))
        {
            break;
        }
    }

    return requestContext;
}

備註

RequestContext,封裝要求訊息和回覆該訊息的機制。RequestContext encapsulates the request message and a mechanism for replying to that message.

ReceiveRequest 可以多次呼叫或同時呼叫。ReceiveRequest can be called multiple times or concurrently. 每個接收要求只會完成一次 ReceiveRequest 呼叫。Only one ReceiveRequest call completes per request received.

如果接收的要求訊息大於要使用繫結所允許的最大訊息大小,則會擲回 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.

適用於