I ask for advice (so sorry if this was asked before):
When I call WCF services, I use the following pattern. I developed this template back with earlier releases of WCF (in VS2008), and now I am wondering if this Close () / Abort () template is still needed in the current WCF version (in VS2010). It certainly works.
I reviewed this and I see many examples calling WCF clients without this template, but I also know that many samples on the Internet are worse. But is it too complicated? What is the perfect pattern?
If you have an answer, it is very important for me that you provide some link so that I can investigate your proposal.
var _Client = new MyServiceReference.MyServiceClient();
try
{
var _Item = _Client.GetItem(123);
_Client.Close();
return _Item;
}
catch
{
_Client.Abort();
throw;
}
source
share