Atul Sureka
Atul Sureka

Reputation: 3312

ApplyClientBehavior is not getting called

I referred to this msdn article http://msdn.microsoft.com/en-us/library/aa717047.aspx for message inspector.

The problem which I am facing is ApplyClientBehavior does not get invoke as a result AfterReceiveReply, & BeforeSendRequest does not get invoke.

I referred to following article http://social.msdn.microsoft.com/Forums/en/wcf/thread/707aa031-f4ff-47ab-ba5b-730f7930605e which says I need to modify client app.config file but not sure what to put in extensibility section. Following does not help

    <behaviorExtensions>
      <add name="Test" type="Client.ServiceReference1.CustomMessageInspectorClient, Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </behaviorExtensions>

Upvotes: 3

Views: 3455

Answers (1)

Rajesh
Rajesh

Reputation: 7886

You need to have reference of your message inspector project added to your client project and then add the behaviour to your client via code as shown below:

client.Endpoint.Behaviors.Add(new SchemaValidationBehavior(null, true, true));

It would be more easy for you do download the sample as said in the msdn article above and go through it to get your sample working.

Upvotes: 3

Related Questions