O'Reilly logo

.NET Framework 4.5 Expert Programming Cookbook by A.P. Rajshekhar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling exceptions using FaultContract and FaultException

Exceptions in applications are common. How they are handled differentiates the good applications from the bad ones. In case of services, the exceptions should be communicated to the clients so that clients can take the appropriate action. For WCF services, handling the exceptions become more important as compared to the other applications. The reason is that once an exception occurs, the underlying channel goes into the faulted state, and hence the server and client will not be able to communicate with each other. In WCF, this can be achieved using FaultContract and FaultException.

In this recipe, we will enhance the ping server by adding a check for the null string passed as the value ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required