WCF Service - What happens if a wcf client/channel isn't explicitly closed?
-
26-06-2021 - |
Question
Say we have the following class in client app:
public class TestClass
{
public void CallWCFService()
{
WCFClient svcClient = new WCFClient("endpointName");
var x = svcClient.GetFoo();
// no Close() or Abort() method here...
}
}
What happens if I create an instance of TestClass
from a different class, and call it's CallWCFService()
method?
Does garbage collection take care of the svcClient?
Does this mean that the service host have an unavailable channel until svcClient eventually dies somehow?
Solution
Yes until the session (if you have one) reaches the timeout you will have a pending connection, depending of how your service is configured that usually drives to great problems
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow