ASP.NET MVCアプリでWCFを使用しており、各メソッドにtry-catch-finallyブロックが含まれています。WCF呼び出しを正しく閉じる/中止するかどうか疑問に思っています。「using」ステートメントはWCF呼び出しには適していないことを私は知っています。
これがサンプルの方法です
public int GetInvalidOrdersCount()
{
OrderServiceClient svc = new OrderServiceClient();
try
{
return svc.GetInvalidOrdersCount();
}
catch (Exception)
{
svc.Abort();
throw;
}
finally
{
svc.Close();
}
}