IClientMessageInspector::BeforeSendRequest Method (Message^%, IClientChannel^)
Enables inspection or modification of a message before a request message is sent to a service.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Parameters
- request
-
Type:
System.ServiceModel.Channels::Message^%
The message to be sent to the service.
- channel
-
Type:
System.ServiceModel::IClientChannel^
The WCF client object channel.
Return Value
Type: System::Object^The object that is returned as the correlationState argument of the AfterReceiveReply method. This is null if no correlation state is used.
The best practice is to make this a System::Guid to ensure that no two correlationState objects are the same.
Implement the BeforeSendRequest to inspect or modify a request message before it is sent.
The following code example shows an implementation that writes strings to the console when the implementation is called.
The following code example shows how to use an System.ServiceModel.Description::IEndpointBehavior to insert the client message inspector in the client endpoint.
Finally, the following code example shows how to modify the client configuration file to use the endpoint behavior with a particular endpoint.
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0