FaultContract with MessageContracts
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?
精彩评论