How and where to implement the IDispatchMessageInspector
Asked Answered
S

0

3

Based on the SO question: How to use IDispatchMessageInspector in a WCF Service?

I am still confused on where to implement the methods that execute code to "do something" with the inspected message.

From reading IDispatchMessageInspector it appears that I need to have a class that implements IDispatchMessageInspector which has these two methods AfterReceiveRequest and BeforeSendReply.

However, I am not understanding where to or how to use those methods.

For example if I wanted to modify an element in the inbound request message before it was dispatched to its operation.

Is this done in the class I create for the servicebehavior which implements my ServiceContract Interface?

Sappington answered 1/7, 2015 at 21:23 Comment(2)
MSDN has a detailed example.Mastat
@nodots, thanks for the link, it was a bit more detailed than what I was looking at. I downloaded the WCF sample projects and was able to step through their code to see what I need to do.Sappington

© 2022 - 2024 — McMap. All rights reserved.