Export (0) Print
Expand All

IClientMessageInspector Interface

Defines a message inspector object that can be added to the MessageInspectors collection to view or modify messages.

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

type IClientMessageInspector =  interface end

The IClientMessageInspector type exposes the following members.

  NameDescription
Public methodSupported in .NET for Windows Store appsAfterReceiveReplyEnables inspection or modification of a message after a reply message is received but prior to passing it back to the client application.
Public methodSupported in .NET for Windows Store appsBeforeSendRequestEnables inspection or modification of a message before a request message is sent to a service.
Top

Implement the IClientMessageInspector interface and add it to the MessageInspectors collection to inspect or modify messages as they pass through a WCF client object. For details, see ClientRuntime.

The following code example shows an implementation that writes strings to the console when the implementation is called.

No code example is currently available or this language may not be supported.

The following code example shows how to use an System.ServiceModel.Description.IEndpointBehavior to insert the client message inspector in the client endpoint.

No code example is currently available or this language may not be supported.

Finally, the following code example shows how to modify the client configuration file to use the endpoint behavior with a particular endpoint.

No code example is currently available or this language may not be supported.
  <client>
      <endpoint 
        address="http://localhost:8080/SampleService" 
        behaviorConfiguration="clientInspectorsAdded" 
        binding="wsHttpBinding"
        bindingConfiguration="WSHttpBinding_ISampleService" 
        contract="ISampleService"
        name="WSHttpBinding_ISampleService"
      >
      </endpoint>
  </client>
<behaviors>
  <endpointBehaviors>
    <behavior name="clientInspectorsAdded">
      <clientInterceptors />
    </behavior>
  </endpointBehaviors>
</behaviors>
<extensions>
  <behaviorExtensions>
    <add 
      name="clientInterceptors" 
      type="Microsoft.WCF.Documentation.InspectorInserter, HostApplication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
  />
  </behaviorExtensions>
</extensions>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Store apps

Supported in: Windows 8

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft