This documentation is archived and is not being maintained.

OperationContext.OperationCompleted Event

Occurs when the operation has completed.

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

public event EventHandler OperationCompleted

Use the OperationCompleted event to dispose parameters or a return value if you set OperationBehaviorAttribute.AutoDisposeParameters to false. Normally you set OperationBehaviorAttribute.AutoDisposeParameters to false to prevent from calling IDisposable.Dispose on the parameter and return value objects. However, if some parameters need to be preserved while others need to be disposed, this event is the best place to dispose those parameters.

Also, with duplex bindings, this event can be used to send a request on the callback channel after the reply for the current operation is sent.


If a caller is listening for the OperationContext.OperationCompleted event for an OperationContractAttribute.IsTerminating operation, it is possible to block when the response is received. The proper way to handle this is to schedule work on another thread when OperationCompleted is raised and then immediately return from that event handler.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

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.