Mité
Mité

Reputation: 1118

The creator of this fault did not specify a Reason

I have set validation attributes in the model of my WCF service

[MinLength(6, ErrorMessage = "Password should be at least 6 characters long")]
public String Password { get; set; }

When this fails I get the exception in the title instead of the error message that I specified in the attribute. I am using the Validation Application Block for WCF.

The method definition is like this:

[OperationContract]
[FaultContract(typeof(ValidationFault))]
User updateUser(User user);

Can someone tell my what I am doing wrong?

Thanks

Upvotes: 1

Views: 11956

Answers (2)

Vivek
Vivek

Reputation: 570

I think you are not handling validation falut. Use validation fault at operation contract . You can refer this link.. http://www.codeproject.com/Articles/18667/Introduction-to-Validation-Application-Block-integ

Upvotes: 1

CodeCaster
CodeCaster

Reputation: 151594

When this fails I get the exception

You should specify the type of Fault you expect, so use

catch (FaultException<ValidationFault> ex)

Upvotes: 2

Related Questions