This documentation is archived and is not being maintained.

OperationContractAttribute.IsTerminating Property

Gets or sets a value that indicates whether the service operation causes the server to close the session after the reply message, if any, is sent.

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

public bool IsTerminating { get; set; }
/** @property */
public boolean get_IsTerminating ()

/** @property */
public void set_IsTerminating (boolean value)

public function get IsTerminating () : boolean

public function set IsTerminating (value : boolean)

Not applicable.

Property Value

true if the operation causes the server to close the session, otherwise, false. The default is false.

Use the IsTerminating property to indicate that calling a service operation terminates the communication session.

In a client application, a value of IsTerminating set to true instructs WCF to close the channel after the reply arrives.

In a service, a timer is set and the channel aborts if the client does not close the channel within that period.

For more information about using this property with sessions, see Using Sessions.

The following example is a service that implements a service contract that specifies three operations. The service requires a stateful connection. If a caller's first call is to any operation other than MethodOne, the channel is refused and an exception is thrown. When a caller initiates a session by calling MethodOne, that caller can terminate the communication session at any time by calling MethodThree. MethodTwo can be called any number of times during a session.

[ServiceContractAttribute(SessionMode=SessionMode.Required)]
public class InitializeAndTerminateService
{
  [OperationContract(
    IsOneWay=true,
    IsInitiating=true,
    IsTerminating=false
  )]
  public void MethodOne()
  {
    return;
  }

  [OperationContract(
    IsInitiating=false,
    IsTerminating=false
  )]
  public int MethodTwo(int x, out int y)
  {
    y = 34;
    return 0;
  }

  [OperationContract(
    IsOneWay=true,
    IsInitiating=false
    IsTerminating=true
  )]
  public void MethodThree()
  {
    return;
  }
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: