WCF Client proxy
If we are creating a WCF application and we are not using sessions and unmanaged resources then it is necessary to close WCF client proxy. If yes then why its so?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit ChoudharyPosted Aug 25, 2011, 12:47 AM
{
///
/// Transitions proxy to closed state via Close() or Abort()
/// dependently on current proxy state
///
public static void CloseProxy
{
try
{
if (proxy.State != CommunicationState.Closed &&
proxy.State != CommunicationState.Faulted)
{
proxy.Close(); // may throw exception while closing
}
else
{
proxy.Abort();
}
}
catch (CommunicationException)
{
proxy.Abort();
throw;
}
}
}