What is instance deactivation in WCF?

I recently came across a term Instance Deactivation.

a) What is it?

b) Why do we need this?

c) In what context would this be useful?

I am looking for a simple answer that can be easily fatal and, if possible, with some pseudo-code.

thank

+3
source share
2 answers

When the WCF method is called, it is passed to the instance service .

An instance of an instance simply refers to the moment the WCF system has this instance.

In the call forwarding service, instance deactivation will be performed after each method call.

, Close -, - .

Singleton , .

:.

[OperationBehavior(ReleaseInstanceMode = ReleaseInstanceMode.AfterCall)]
 public void MyMethodWhichTriggersAnAutomaticRelease()
 {
     // ...
 }

, :

public void MyMethodWhichTriggersAManualRelease()
{
     OperationContext.Current.InstanceContext.ReleaseServiceInstance();
}

Juval Lowy , :

- , , . , .

+3

, , , . , , . .

, , , , , .

MSDN: WCF ​​ @SteveCav, .

+1

Source: https://habr.com/ru/post/1762215/


All Articles