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 5994409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:48:50+00:00 2026-05-22T23:48:50+00:00

I need to create a (WCF) client that communicates with a service that expects

  • 0

I need to create a (WCF) client that communicates with a service that expects the messages to be signed. Since I’m quite new to WCF I first tried to setup a simple selfhost service and a client that talks to this servive.

Both the service and client have message inspectors so I can see what’s going over the line.

The strange thing however is that the MessageInspector on the client is NOT showing any signing of the message, while the MessageInspector on the service is showing a Security header.

My question is, can I influence the moment the messageinspector get called, I guess that it is called before WCF signed the message.

I use the folowing code on then client side, with no additional config settings:

EndpointAddress address = new EndpointAddress("http://localhost:8001/Someplace/CalculatorService");
WSHttpBinding wsbinding = new WSHttpBinding(SecurityMode.Message);

ChannelFactory<ICalculator> factory = new ChannelFactory<ICalculator>(wsbinding, address);
factory.Endpoint.Behaviors.Add(new MyBehaviour());
factory.Credentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, 
    StoreName.My,X509FindType.FindBySubjectName, "MyCertificate");
factory.Credentials.ServiceCertificate.SetDefaultCertificate(StoreLocation.CurrentUser, 
    StoreName.AddressBook, X509FindType.FindBySubjectName, "MyCertificate");

ICalculator client = factory.CreateChannel();
var total = client.Add(10, 20);

....

class MyInspector : IClientMessageInspector

   public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
   {
       Console.WriteLine("IClientMessageInspector.AfterReceiveReply called.");
       Console.WriteLine("Message: {0}", reply.ToString());
   }
   public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel)
   {
       Console.WriteLine("IClientMessageInspector.BeforeSendRequest called.");
       Console.WriteLine("Message: {0}", request.ToString());
       return null;
   }

class MyBehaviour : IEndpointBehavior

   public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
   {
       return;
   }
   public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
   {
       clientRuntime.MessageInspectors.Add(new MyInspector());
   }
   public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
   {
   }
   public void Validate(ServiceEndpoint endpoint)
   {
       return;
   }
}
  • 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-05-22T23:48:50+00:00Added an answer on May 22, 2026 at 11:48 pm

    No you can’t control when in the pipeline the message inspectors are called. Instead of using message inspectors to inspect the messages, use WCF message tracing + svctraceviewer.exe instead.

    http://msdn.microsoft.com/en-us/library/ms733025.aspx

    http://msdn.microsoft.com/en-us/library/ms732023.aspx

    • 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. now, I need to create a client that consumes
I need to create a WCF service that only allows a single client at
Suppose I wanted to create a WCF WebHTTP service (ServiceREST) that had a reference
Caution, WCF noobie alert I need to create a WCF client to query a
I have implemented a WCF service that exposes operations that a Windows Forms client
I'm working on a simple plug-in framework. WCF client need to create an instance
What is a good way to create a WCF service layer so that a
I need to create wcf service for sharepoint 2010. The idea to use Jquery
I need to create a service which will maintain a WCF session. In the
I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>

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.