public void Dispose()
 {
     if (_channel != null)
     {
         _channel.Disconnect();
     }
 }
Exemple #2
0
        public IConfigurationSession OpenConfigurationSession(IClientAuthenticationCredential credentials)
        {
            this.credentials = credentials;
            try
            {
                _session = new OutProcConfigurationSession(_serviceURI, _channel, credentials, _channelFormatter);
                _session.IsDatabaseSession       = isDatabaseClient;
                _session.IsDistributorSession    = isDistributorClient;
                _session.IsConfigurationSession  = isConfigurationClient;
                ServerAuthenticationCredenital   = _session.Authenticate(credentials);
                _session.Channel.IsAuthenticated = ServerAuthenticationCredenital.IsAuthenticated;
                _session.SessionType             = _sessionType;

                if (ServerAuthenticationCredenital.IsAuthenticated)
                {
                    DetermineSecondaryConfigurationServer();
                    _session.SessionId = ServerAuthenticationCredenital.SessionId;
                    return(_session);
                }
                else
                {
                    throw new Alachisoft.NosDB.Common.Security.SecurityException(ErrorCodes.Security.USER_NOT_REGISTERED, new string[1] {
                        credentials.UserName
                    });
                }
            }
            catch (Exception ex)
            {
                _channel.Disconnect();
                throw;
            }
        }