有一个服务错误契约是这样的BusinessFault
throw new FaultException<BusinessFault>(new BusinessFault(), errMessage);
这样抛出后,客户端一直收到的是CommunicationException而不是上面的具体的Exception.最后使用如下代码通过
BusinessFault businessFault = new BusinessFault { FaultDetail = new FaultDetail { ErrorCode = "BusinessError", Message = string.IsNullOrEmpty(errMessage) ? errMessage : "No Message" },InvalidArgumentDetail = new InvalidArgumentDetail() }; throw new FaultException<BusinessFault>(businessFault,errMessage);