开发者

How to Catch Exceptions in WPF when Calling a WCF Service

开发者 https://www.devze.com 2022-12-13 12:44 出处:网络
How can I catch exceptio开发者_运维问答ns in WPF when calling a WCF Service?Basically you\'ll have three approaches:

How can I catch exceptio开发者_运维问答ns in WPF when calling a WCF Service?


Basically you'll have three approaches:

  • Rethrow FaultException on your regular try/catch
  • Mark your OperationContract with FaultContract attribute and translate your Exception to your custom Fault object, manually
  • To implement a 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.

0

精彩评论

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