. Advertisement .
..3..
. Advertisement .
..4..
I don’t know what I’m doing wrong, but I’ve already lost a couple of days struggling with this. Here is my command line:
tcpClient = (TcpClient)client;
clientStream = tcpClient.GetStream();
sr = new StreamReader(clientStream);
sw = new StreamWriter(clientStream);
// line 96:
a = sr.ReadLine();
This returns:
Couldn't get stream from client or login failed: System.IO.IOException:
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
I don’t have any experience with the “unable to read data from the transport connection.” In this case, how should I change?
The cause: This error typically indicates that the target machine is running, but the service you’re trying to connect to isn’t. (It either came to a halt, crashed, or is preoccupied with another request.)
The solution: The issue was rectified by adding the following line before making the call:
This error occurred when I called a web-service. This issue also had to do with transport level security. Although I could call the web service through a website project it would not work if I used the same code in a test program. I would then get this message as a WebException. The issue was resolved by adding the following line before calling the web-service:
Edit
When selecting the protocol version, I think the
SecurityProtocol
configuration should be considered.