private static void GetUserId(string serverName, string userName, string password, bool verbose) { Uri tcpUri = new Uri(serverName); NetTcpBinding binding = new NetTcpBinding(SecurityMode.TransportWithMessageCredential); binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; if (verbose) { Console.WriteLine("Connecting to: " + serverName); } EndpointAddress address = new EndpointAddress(tcpUri); TradingSupportClient client = new TradingSupportClient(binding, address); client.ClientCredentials.UserName.UserName = userName; client.ClientCredentials.UserName.Password = password; Guid result = client.GetUserId(); if (verbose) { Console.WriteLine("UserId: " + result.ToString()); } }