If the server is direct reachable, everything works fine. It make no sense if the server is in the same network, routed to another subnet or tunneled over a vpn connection.
Debug the code in Visual Studio works, and also the compiled version.
Now I place the server behind a firewall. Because the server have no connection to the network, where the application runs, I make a SAT-Rule that all traffic to a address inside the "program-network" is forwarded to the address in the "server-network". Check the configuration with Putty, and everything works fine.
Now it will we a little bit crazy.
Debug the program inside Visual Studio everything works fine.
Run the compiled version on the same computer the connection will be immediately closed.
On the server I only see the connection open, and a connection closed. I don't see any other messages.
The program raise an exception with the message " An established connection was aborted by the software in your host machine"
<code>
using (var ssh = new SshClient(sshHost, sshPort, sshUser, sshPass))
{
ssh.Connect();
var terminal = ssh.RunCommand(command);
output = terminal.Result;
ssh.Disconnect();
ssh.Dispose();
//Console.WriteLine("OUT: " + output);
}
</code>
Debug the code in Visual Studio works, and also the compiled version.
Now I place the server behind a firewall. Because the server have no connection to the network, where the application runs, I make a SAT-Rule that all traffic to a address inside the "program-network" is forwarded to the address in the "server-network". Check the configuration with Putty, and everything works fine.
Now it will we a little bit crazy.
Debug the program inside Visual Studio everything works fine.
Run the compiled version on the same computer the connection will be immediately closed.
On the server I only see the connection open, and a connection closed. I don't see any other messages.
The program raise an exception with the message " An established connection was aborted by the software in your host machine"
<code>
using (var ssh = new SshClient(sshHost, sshPort, sshUser, sshPass))
{
ssh.Connect();
var terminal = ssh.RunCommand(command);
output = terminal.Result;
ssh.Disconnect();
ssh.Dispose();
//Console.WriteLine("OUT: " + output);
}
</code>