Esempio n. 1
0
        public void Open(IConnectKeys connectKeys)
        {
            if (_channelFactory != null)
            {
                if (_channelFactory.State == CommunicationState.Opened || _channelFactory.State == CommunicationState.Opening)
                {
                    return;
                }
            }

            var serviceAddress = new EndpointAddress(connectKeys.Url);

            _channelFactory = new ChannelFactory <IConnectService>(GetBinding(), serviceAddress);

            var credentials = new ConnectClientCredentials(connectKeys);

            credentials.ServiceCertificate.DefaultCertificate = GetCertificate();

            _channelFactory.Endpoint.Behaviors.Remove(typeof(ClientCredentials));
            _channelFactory.Endpoint.Behaviors.Add(credentials);

            Service = _channelFactory.CreateChannel();
        }
 public ConnectClientCredentialsSecurityTokenManager(ConnectClientCredentials connectClientCredentials)
     : base(connectClientCredentials)
 {
     _credentials = connectClientCredentials;
 }