The short answer is: you are not doing anything wrong, just reading the results incorrectly.
On the client side, when you catch an error, what is caught is of type System.ServiceModel.FaultException<InvalidRoutingCodeFault> .
Your InvalidRoutingCodeFault object InvalidRoutingCodeFault actually in the .detail property of the FaultException. SO ....
//Client code
private static void InvokeMyMethod() { ServiceClient service = new MyService.ServiceClient(); try { service.MyMethod(); } catch (System.ServiceModel.FaultException<InvalidRoutingCodeFault> ex) {
The Message property for FaultException is what is displayed on the error page, so if it is not filled, as in the John Egerton column, you will see the message "The creator of this error did not indicate the message" Cause ". To easily fill it, use two parameter constructors when calling an error in the service as follows, passing the error message from your type of error:
InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - No Approval Started"); throw new FaultException<InvalidRoutingCodeFault>(fault, new FaultReason(fault.ErrorMessage));
Daniel Davis Sep 10 '12 at 20:12 2012-09-10 20:12
source share