Export (0) Print
Expand All

RequestContext Class

Provides a reply that is correlated to an incoming request.

System.Object
  System.ServiceModel.Channels.RequestContext

Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public abstract class RequestContext : IDisposable

The RequestContext type exposes the following members.

  NameDescription
Protected methodSupported by Silverlight for Windows PhoneRequestContextInitializes a new instance of the RequestContext class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneRequestMessageWhen overridden in a derived class, gets the message that contains the request.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneAbortWhen overridden in a derived class, aborts processing the request associated with the context.
Public methodSupported by Silverlight for Windows PhoneBeginReply(Message, AsyncCallback, Object)When overridden in a derived class, begins an asynchronous operation to reply to the request associated with the current context.
Public methodSupported by Silverlight for Windows PhoneBeginReply(Message, TimeSpan, AsyncCallback, Object)When overridden in a derived class, begins an asynchronous operation to reply to the request associated with the current context within a specified interval of time.
Public methodSupported by Silverlight for Windows PhoneClose()When overridden in a derived class, closes the operation that is replying to the request context associated with the current context.
Public methodSupported by Silverlight for Windows PhoneClose(TimeSpan)When overridden in a derived class, closes the operation that is replying to the request context associated with the current context within a specified interval of time.
Protected methodSupported by Silverlight for Windows PhoneDisposeReleases resources associated with the context.
Public methodSupported by Silverlight for Windows PhoneEndReplyWhen overridden in a derived class, completes an asynchronous operation to reply to a request message.
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneReply(Message)When overridden in a derived class, replies to a request message.
Public methodSupported by Silverlight for Windows PhoneReply(Message, TimeSpan)When overridden in a derived class, replies to a request message within a specified interval of time.
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneIDisposable.DisposeReleases both managed and unmanaged resources associated with the context.
Top

You get a request context from an IReplyChannel. Each RequestContext encapsulates the information required to reply to the request, so that you do not have to block on the channel when waiting for each request message to receive a reply.

In the request/reply model, the RequestContext object is the link between the request that comes in and the reply that goes out. When the server receives a request, it provides a RequestContext instance that represents the request to the channel. The request context contains the original request message among other useful properties. This request context is then stashed inside the OperationContext for retrieval by your service. You typically use the Current property to access the request of the current operation.

The value of the RequestContext can be null. Because the role of the request context is to link requests to replies, it does not make sense to have a request context when you do not have a reply, and so in this case the context is set to null. For a one-way operation on top of the request/reply model, the server receives requests but does not send back a response to the client. So if the RequestContext is null unexpectedly, check first whether the operation contract is IsOneWay.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft