ExceptionHandler Class
Extend the ExceptionHandler class to create an exception handler for unhandled exceptions that occur within the runtime.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The ExceptionHandler type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | AlwaysHandle | Gets an instance of ExceptionHandler that handles all exceptions. |
![]() ![]() | AsynchronousThreadExceptionHandler | Gets or sets the current ExceptionHandler implementation for the application domain. |
![]() ![]() | TransportExceptionHandler | Gets or sets the current transport ExceptionHandler implementation for the application domain. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | HandleException | When overridden in a derived class, returns true if the exception has been handled, or false if the exception should be rethrown and the application terminated. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Extend the ExceptionHandler class and override the HandleException method to determine whether an exception should terminate the application. Then create a new instance of your custom ExceptionHandler class and assign it to the static AsynchronousThreadExceptionHandler or TransportExceptionHandler property prior to creating clients or services.
The following code example shows an implementation of the ExceptionHandler abstract class that overrides the HandleException method.
The following code example shows how to enable the custom MyExceptionHandler for unhandled exceptions that occur within the runtime.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
