The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
HttpListener httpListener = new HttpListener(); httpListener.Prefixes.Add(httpListenerPrefix); httpListener.Start();
public async Task Connect(string uri) { //NeSTCommonClass.WriteTextFile(LogPath + Logfilename, "Client:Handshake Connectivity Process Sending Starts", true); Thread.Sleep(1000); //wait for a sec, so server starts and ready to accept connection.. // ClientWebSocket webSocket = null; try { webSocket = new ClientWebSocket(); await webSocket.ConnectAsync(new Uri(uri), CancellationToken.None); //NeSTCommonClass.WriteTextFile(LogPath + Logfilename, "Client:Handshake Connectivity Process Sending Ends", true); //await Task.WhenAll(Receive(webSocket)); } catch (Exception ex) { txtError.Text += "Client:HandShake Connectivity Process Failed: "+ ex.Message.ToString()+" "+ MethodInfo.GetCurrentMethod().Name + Environment.NewLine; txtError.Text += "Client:HandShake Connectivity Process Failed: " + ex.InnerException.ToString() + " " + MethodInfo.GetCurrentMethod().Name + Environment.NewLine; txtError.Text += "Client:HandShake Connectivity Process Failed: " + ex.StackTrace.ToString() + " " + MethodInfo.GetCurrentMethod().Name + Environment.NewLine; //NeSTCommonClass.WriteTextFile(LogPath + Logfilename, "Client:HandShake Connectivity Process Failed: " + ex.Message.ToString() + "", true); } finally { if (webSocket != null) webSocket.Dispose(); //Console.WriteLine(); //Console.WriteLine("WebSocket closed."); } // NeSTCommonClass.WriteTextFile(LogPath + Logfilename, "Client:Handshake Connectivity Process Sending from Client Level Process Ends", true); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)