1

How can I catch exceptions in WPF when calling a WCF Service?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
hui
  • 11
  • 1

2 Answers2

3

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

Rubens Farias
  • 57,174
  • 8
  • 131
  • 162
0

I think this has already been covered by this question on stack overflow. WPF Exceptions

Bob.

Community
  • 1
  • 1
scope_creep
  • 4,213
  • 11
  • 35
  • 64