3

I've implemented idispatchmessageinspector in my service. I did not want to do this as an attribute. I want the BeforeSendReply to add additional data into the header. the problem I have is that it is not being called and the header is returned null. essentially, I am treating this as event driven to have this called every time the method completes execution.

could someone explain the execution of the BeforeSendReply?

hope it makes sense.

A sample of what I want to accomplish have below:

class test
implements itest
implements idispatchmessageinspector 

public function testFunction as string implements itest.testFunction 
begin
return somestring
end

sub BeforeSendReply (reply ...) implement ..
begin

dim header = ...

reply.headers.add(header)

end
radu florescu
  • 4,315
  • 10
  • 60
  • 92
Azad
  • 31
  • 3

1 Answers1

4

Making a class implement the IDispatchMessageInspector interface doesn't make it be added to the WCF pipeline. You need to use a behavior to insert an instance of the inspector in the endpoint dispatch runtime. You can find more detailed information at http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx.

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171