How to correctly open WCF service
- by Sergej Andrejev
Hi there,
I'm using WCF client like this...
var client = new TestClient();
try
{
response = service.Operation(request);
}
finally
{
try
{
if (client.State != CommunicationState.Faulted)
client.Close();
}
catch (Exception)
{
client.Abort();
}
}
but from time to time I get 500 HTTP error which is the only answer I get for next 15 minutes, then everything is back to normal for 15 minutes and so on. I know there is some load balancing stuff going on service side but guys there can't find any problems with it.
That's why I started wondering am I using WCF service correctly. I already made a mistake once when I was using "using" to close service connection and I'm afraid I doing something wrong again.
So can anybody say whether my way of calling WCF service is correct or not in all (event the most rare) circumstances?