Muokkaa

Jaa


IReplyChannel.ReceiveRequest Method

Definition

Returns the context of the request received, if one is available.

Overloads

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

Source:
IReplyChannel.cs
Source:
IReplyChannel.cs

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

Returns

The RequestContext used to construct replies.

Examples

The following code illustrates how to implement this method:

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

Remarks

RequestContext encapsulates the request message and a mechanism for replying to that message.

ReceiveRequest can be called multiple times or concurrently. Only one ReceiveRequest call completes per request received.

If the request message received is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. The maximum message size is set by the MaxReceivedMessageSize property. The default value is 65536 bytes.

Applies to

ReceiveRequest(TimeSpan)

Source:
IReplyChannel.cs
Source:
IReplyChannel.cs

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

Parameters

timeout
TimeSpan

The TimeSpan that specifies how long the receive of a request operation has to complete before timing out and returning false.

Returns

The RequestContext used to construct replies.

Examples

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;
}

Remarks

RequestContext encapsulates the request message and a mechanism for replying to that message.

ReceiveRequest can be called multiple times or concurrently. Only one ReceiveRequest call completes per request received.

If the request message received is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. The maximum message size is set by the MaxReceivedMessageSize property. The default value is 65536 bytes.

Applies to