调用WCF服务时如何在WPF中捕获异常?
Basically you'll have three approaches:
FaultException
on your regular try/catch OperationContract
with FaultContract
attribute and translate your Exception to your custom Fault object, manually IErrorHandler
behavior and let it handle WCF exceptions to you This link can explain these options: Simplifying WCF: Using Exceptions as Faults
I think this has already been covered by this question on stack overflow. WPF Exceptions
Bob.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.