Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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? Or should I log it and return a user friendly message?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
200 views
Welcome To Ask or Share your Answers For Others

1 Answer

Using strongly typed or non-typed FaultException is a way to accomplish this. There is an excellent article Simplifying WCF: Using Exceptions as Faults that describes how to use each. As the article points out, depending on complexity of your service you may opt to choose simpler untyped FaultException and pass exception info to the client.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...