I have net tcp WCF as shown below.
[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, is the destructor not called? What for? Does this mean that the service object is still running on the server?
source share