Input validation WCF

Topics: General discussion, Validation Application Block
Sep 13, 2010 at 4:23 PM

Hi guys,

I have a WCF service defining a number of methods, and i would like to validate all input (against say a regex)  to ensure all data getting into the service is valid.

I use the various enterprise library validation attributes on the data contracts so that this can be handled relatively painlessly.

What is the prescribed method for communicating any failures of validation back to the client? Is it possible that raising a fault is not the right thing to do (even raising ValidationFault, no matter how applicable it may seem!) as this is using exceptions to control program flow?

If this is not an acceptable manner of communicating validation failure back to the client, then what is the recommended practice?

Thanks for any help guys, will be much appreciated!


Sep 14, 2010 at 2:56 AM

The Validation Application Block's integration with WCF encapsulates Microsoft's recommended best practice for handling validation failures in WCF service.  You may want to post this also in WCF forums and see if there are other approaches which people prefer. 


Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.