Chapter 3: Making Applications and Services Robust


image from book Download CD Content

Overview

After completing this chapter, you will be able to:

  • Explain how the WCF runtime can convert common language runtime exceptions into SOAP fault messages to transmit exception information from a WCF service.

  • Use the FaultContract attribute in a service to define strongly-typed exceptions as SOAP faults.

  • Catch and handle SOAP faults in a client application.

  • Describe how to configure a WCF service to propagate information about unanticipated exceptions to client applications for debugging purposes.

  • Describe how to detect the Faulted state in a WCF service host application and how to recover from this state.

  • Explain how to detect and log unrecognized messages sent to a service.

Detecting and handling exceptions is an important part of any professional application. In a complex desktop application, many different situations can raise an exception, ranging from events such as unexpected or malformed user input, and programming errors, to failure of one or more hardware components in the computer running the application. In a distributed environment, the scope for exceptions is far greater, due to the nature of networks, and the fact that, in some cases, neither the application nor the development or administrative staff have control over how the network functions or its maintenance (Who is responsible for making sure that the Internet works?). If you factor in the possibility that your application might also access services written by some third party, who may modify or replace the service with a newer version (possibly untested!), or who may decide to remove the service altogether, then you might begin to wonder whether your distributed applications will ever be able to work reliably.

In this chapter, you will learn about how to handle exceptions in client applications and services developed by using WCF. You will learn how to specify the exceptions that a WCF service can raise and how to propagate information about exceptions from a WCF service to a WCF client. You will also learn about the states that a service can be in, how to determine when a host application switches from one state to another, and how to recover a service that has failed. Finally, you will see how to detect unrecognized messages sent to a service by client applications.




Microsoft Windows Communication Foundation Step by Step
Microsoft Windows Communication Foundation Step by Step (Step By Step Developer Series)
ISBN: 0735623368
EAN: 2147483647
Year: 2007
Pages: 105
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net