Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:46:19+00:00 2026-06-02T19:46:19+00:00

I can inspect WCF messsages on both Client side and server side using IClientMessageInspector,

  • 0

I can inspect WCF messsages on both Client side and server side using IClientMessageInspector, IDispatchMessageInspector respectively. But in a Duplex comunications it is not clear how to do it in a callback from server to client (Nor much documentation on that topic).

Any ideas about how to implement this feature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:46:20+00:00Added an answer on June 2, 2026 at 7:46 pm

    Finally I get the solution.

    In a Duplex comunication scenario when a callback is made the server becomes the client and vice versa.

    So on server side when implementing IServiceBehavior inject the message inspector using the CallbackClientRuntime property of the DispatchRuntime foreach EndpointDispatcher.

    public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
    {
        foreach (ChannelDispatcher item in serviceHostBase.ChannelDispatchers)
        {
            foreach (EndpointDispatcher epd in item.Endpoints)
            {
                //injecting an inspector in normal call
                epd.DispatchRuntime.MessageInspectors.Add(new MessageSizerInspector());
    
                //injecting an inspector in callback
                epd.DispatchRuntime.CallbackClientRuntime.MessageInspectors.Add(new MessageSizerInspector());
            }
        }
    }
    

    On client side when implementing IEndpointBehavior inject the message inspector using the CallbackDispatchRuntime.

    public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
    {
        //injecting an inspector in normal call
        clientRuntime.MessageInspectors.Add(new MessageSizerInspector());
    
        //injecting an inspector in callback
        clientRuntime.CallbackDispatchRuntime.MessageInspectors.Add(new MessageSizerInspector());       
    }
    

    Then apply the extension as always.

    In my case I created a class like the following pseudo code

    public class MessageSizer : Attribute, IServiceBehavior, IEndpointBehavior
    {
        .....
    }
    

    then I applied this attribute to service implementation for the server side inspection
    and added a behaviorExtensions inside the app.config to setup the endpoint for message inspection on client side.

    <system.serviceModel>
        ...........
        <client>
          <endpoint address="net.tcp://localhost/MinerDual.svc"
                binding="netTcpBinding" bindingConfiguration="wsDualMinerNetTcp"
                contract="WebApplication.IMinerDual" name="NetTcpMinerDual" 
                behaviorConfiguration="Default" />
        </client>
      <behaviors>
        <endpointBehaviors >
          <behavior name="Default">
            <messageSizer/>
          </behavior>
        </endpointBehaviors>
      </behaviors>
      <extensions>
        <behaviorExtensions>
          <add name="messageSizer"
               type="WCFExtensions.MessageSizerElement, WCFExtensions, 
               Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
        </behaviorExtensions>
      </extensions>
    </system.serviceModel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF Service, And I inspect that using MessageInspector ( inherit IDispatchMessageInspector)
Is there any command using which we can inspect a object in command line
In Ruby 1.9.2 you can inspect the parameters of any method using method(:symbol). How
I can inspect any Javascript-generated DOM by using Firebug or another debugger. Firebug also
Can anyone tell me how to hide the header in DevExpress gridcontrol..?? I'm using
Can the Application Name passed to SQL Server (via the ADO Connection string) be
Can we do following in SQL Server 2005 query with convert function. MaxRegID =
I have a WCF service with a client application. I have complete control over
I have created a WCF WebHttp Service using the following article as a guideline..
Is there a tool or process that can inspect the code in a repo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.