IDispatchMessageInspector::AfterReceiveRequest Method (Message^%, IClientChannel^, InstanceContext^)
Called after an inbound message has been received but before the message is dispatched to the intended operation.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Object^ AfterReceiveRequest( Message^% request, IClientChannel^ channel, InstanceContext^ instanceContext )
Parameters
- request
-
Type:
System.ServiceModel.Channels::Message^%
The request message.
- channel
-
Type:
System.ServiceModel::IClientChannel^
The incoming channel.
- instanceContext
-
Type:
System.ServiceModel::InstanceContext^
The current service instance.
Return Value
Type: System::Object^The object used to correlate state. This object is passed back in the BeforeSendReply method.
Use the AfterReceiveRequest method to inspect or modify the incoming message, the client channel that provided it, and the current service instance. The return value can be any object that you want to use for correlation purposes; it is returned to you as the correlationState parameter in the BeforeSendReply method.
Important |
|---|
You cannot use the body of the message unless you buffer the entire message and make a copy. If you do this, you must make two copies of the message: one to inspect, and the other to overwrite the request parameter. |
The following code example shows a basic IDispatchMessageInspector that writes a string to the console when it is invoked.
The following code example shows the implementation of an IServiceBehavior that adds the InspectorIDispatchMessageInspector to the DispatchRuntime::MessageInspectors collection.
The following code example shows the use of an application configuration file to load the service behavior that inserts the InspectorIDispatchMessageInspector.
Available since 3.0
