Answered by:
MessageInspector or Orperation Behavior

Question
-
User-221752185 posted
Trying to understand really when to the OperationBehavior. My scenario... The client needs to send a timestamp in a message header to my WCF. The WCF needs to validate that the timestamp is valid and no more than 30 mins out of bounds to the server time. Rather then checking and duplicating code on each operation, I'd rather just write it once. I was thinking to use OpertaionBehavior, but then MessageInspector looks at the message... Im a bit confused.
Tuesday, April 2, 2013 7:38 AM
Answers
-
User220959680 posted
MessageInspectorA message inspector is an extensibility object that can be used in the service model's client runtime and dispatch runtime programmatically or through configuration and that can inspect and alter messages after they are received or before they are sent. MSDN Reference
OperationBehaviorSpecifies the local execution behavior of a service method. MSDN ref
The WCF needs to validate that the timestamp is valid and no more than 30 mins out of bounds to the server time.As suggested above this can be achieved through Timeout property, which is configurable through Web.config
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, April 2, 2013 9:53 AM
All replies
-
User220959680 posted
Timeout can be utilised to meet the requirement.
http://msdn.microsoft.com/en-us/library/hh924831.aspx
http://blogs.msdn.com/b/hongmeig/archive/2010/03/06/timeouts-in-wcf-and-their-default-values.aspx
Tuesday, April 2, 2013 8:29 AM -
User-221752185 posted
I would appreciate it if you could satisfy my question in regards to MessageInspector vs OperationBehavior. I need to have a better understanding of these too and why one would be a more appropriate solution.
Tuesday, April 2, 2013 9:05 AM -
User220959680 posted
MessageInspectorA message inspector is an extensibility object that can be used in the service model's client runtime and dispatch runtime programmatically or through configuration and that can inspect and alter messages after they are received or before they are sent. MSDN Reference
OperationBehaviorSpecifies the local execution behavior of a service method. MSDN ref
The WCF needs to validate that the timestamp is valid and no more than 30 mins out of bounds to the server time.As suggested above this can be achieved through Timeout property, which is configurable through Web.config
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, April 2, 2013 9:53 AM -
User-221752185 posted
Could you use the OperationBehavior to do this? What is the difference between an OperationBehavior and a ContractBehavior?
Tuesday, April 2, 2013 10:01 AM