WCF - Faults / Exceptions versus Messages

前端 未结 3 2040
轻奢々
轻奢々 2020-12-07 17:12

We\'re currently having a debate whether it\'s better to throw faults over a WCF channel, versus passing a message indicating the status or the response from a service.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 17:27

    I would seriously consider using the FaultContract and FaultException objects to get around this. This will allow you to pass meaningful error messages back to the client, but only when a fault condition occurs.

    Unfortunately, I'm in a training course at the moment, so can't write up a full answer, but as luck would have it I'm learning about exception management in WCF applications. I'll post back tonight with more information. (Sorry it's a feeble answer)

提交回复
热议问题