mcass20
mcass20

Reputation: 1688

In XML Web Services, what is the best practice for passing exceptions back to the client?

If my web method throws an exception, what is the best practice for passing that exception to the client?

Upvotes: 6

Views: 520

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038890

  • In plain old asmx services by catching this exception and rethrowing a SoapException and filling the Detail property.
  • In WCF by throwing a FaultException<T>. As far as the catching is concerned a good place to do this is a custom IErrorHandler that would provide the appropriate fault to the client.

Upvotes: 4

Related Questions