开发者

FaultContract with MessageContracts

开发者 https://www.devze.com 2023-03-03 13:34 出处:网络
I am using MessageContracts for my WCF services; I am grouping various DataContracts into a single MessageContracts. My base response is con开发者_如何学Ctains - isOperationSuccess (bool), exceptionMe

I am using MessageContracts for my WCF services; I am grouping various DataContracts into a single MessageContracts. My base response is con开发者_如何学Ctains - isOperationSuccess (bool), exceptionMessage (Exception). If an error occurs at service level, I am assigning into exceptionMessage and setting the isOPerationSuccess to false; and returning the response.

Do I still have to handle / catch the FaultContract at client (my service includes a FaultContract attribute?

My question is where do I need to use FaultContract with MessageContracts?


If the operation has a FaultContract attribute on it, then it may return a fault. Of course your client should handle that.


If the operation has a FaultContract attribute on it, then it may return a fault. Of course your client should handle that.

Of course client has to handle it; but if you look at my response message, it includes an exception object into which I am filling the server exception. In this scenario, do I have any condition where I'll get a FaultContract?

0

精彩评论

暂无评论...
验证码 换一张
取 消