I wrapped my wcf client in an IDisposable shell and everything works correctly, I have a test case that runs this x times after about 10 times. I'm starting to get a timeout
There is a helper in the calling code wrapped in a using statement, so tbh I lost a little
Does anyone shed light on this?
public class CrmServiceHelper : IDisposable
{
private CrmServices.CRMServicesClient client;
public CrmServices.CRMServicesClient GetClient
{
get
{
lock (this)
{
if (client == null)
client = new CrmServices.CRMServicesClient();
}
return client;
}
}
public void Dispose()
{
try
{
client.Close();
}
catch (CommunicationException ex)
{
client.Abort();
}
catch (TimeoutException ex)
{
client.Abort();
}
}
}
Example usage code:
using (CrmServiceHelper client = new CrmServiceHelper())
{
AListReponse resp = client.GetClient.GetAList(companyId);
if ((resp != null) && (resp.AList != null))
{
return resp.AList ;
}
else
{
return null;
}
}
Service Configuration
source
share