WCF Exception Handling

前端 未结 3 1952
粉色の甜心
粉色の甜心 2020-12-17 00:49

If an exception occurs in my WCF service, what is the best way to communicate that error to the client?

Should I log it on the service and rethrow a soap exception?

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 01:05

    I would log it and return a FaultException. When you create the FaultException you can pass a user friendly message within it back to the client.

提交回复
热议问题