I have a net tcp WCF service as follows
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class AVService : IAVService
{
static int _numberofInst = 0;
public AVService()
{
++_numberofInst;
Console.WriteLine("Number of instances "+_numberofInst);
}
~AVService()
{
--_numberofInst;
Console.WriteLine("Number of instances " + _numberofInst);
}
public void Foo(){}
}
When I create an object on the client side as follows
AVService client = new AVService();
client.Foo();
The constructor is called, but when I close the client application without calling close mehotd, the destructor does not been called? why? does this mean the service object still works on the server?