public ClientService(string hostAddress, IDatabaseWrapper dbWrapper) { NetTcpBinding raBinding = new NetTcpBinding(); raBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; string raAddress = "net.tcp://localhost:10002/RegistrationAuthorityService"; //string raAddress = "net.tcp://10.1.212.108:10002/RegistrationAuthorityService"; NetTcpBinding vaBinding = new NetTcpBinding(); vaBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; string vaAddress = "net.tcp://localhost:10003/ValidationAuthorityService"; //string vaAddress = "net.tcp://10.1.212.108:10003/ValidationAuthorityService"; vaProxy = new VAProxy(vaAddress, vaBinding); raProxy = new RAProxy(raAddress, raBinding); clientSessions = new Dictionary <string, SessionData>(); this.HostAddress = hostAddress; InitializeDatabase(dbWrapper); LoadMyCertificate(); }
static bool ConsoleEventCallback(int eventType) { if (clientService != null && (eventType == 2 || eventType == 0)) { NetTcpBinding binding = new NetTcpBinding(); binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; string address = "net.tcp://localhost:10002/RegistrationAuthorityService"; var raProxy = new RAProxy(address, binding); using (new OperationContextScope(raProxy.GetChannel())) { string myAddress = clientService.HostAddress; clientService.RemoveInvalidClient(null); MessageHeader aMessageHeader = MessageHeader.CreateHeader("UserName", "", clientService.ServiceName); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); //caProxy.RemoveMeFromList(); raProxy.RemoveActiveClient(); } raProxy.Close(); clientService.Dispose(); } return(false); }