This documentation is archived and is not being maintained.

ExceptionHandler.HandleException Method

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.

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public abstract bool HandleException(
	Exception exception


Type: System.Exception

The exception the occurred within the Windows Communication Foundation (WCF) runtime and which may terminate the application.

Return Value

Type: System.Boolean
true if the exception has been handled; otherwise, false.

The HandleException property returns true if the exception has been handled. If it returns false or throws a different exception, the original exception is rethrown.

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 WCF runtime.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0