/// <summary>
 /// Constructor, initialize a NRPC client.<para/>
 /// Create the instance will not connect to server, 
 /// you should call one of BindOverTcp or BindOverNamedPipe 
 /// to actually connect to NRPC server.
 /// </summary>
 /// <param name="domainName">Domain name</param>
 private NrpcClient(string domainName)
 {
     context = new NrpcClientContext();
     context.DomainName = domainName;
     rpc = new NrpcRpcAdapter();
 }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Release managed resources.
                disposeMutex.WaitOne();
                if (rpc != null)
                {
                    try
                    {
                        rpc.Unbind();
                    }
                    catch
                    {
                        //Ignore the exception thrown by Unbind.
                    }
                    rpc.Dispose();
                    rpc = null;
                }
                disposeMutex.ReleaseMutex();
            }

            // Release unmanaged resources.
        }