Connection failed when trying to open a session

Advertisement

rl
Joined:
Posts:
2

Connection failed when trying to open a session

Hello,
When I try to open a session, I get one of these exceptions (depending on the SessionOptions):
Could not read status line: An existing connection was forcibly closed by the remote host.
or
Could not read status line: connection was closed by server
– I tried running a batch file with an open command – runs successfully.
– WinSCP.exe also connected successfully.
Any suggestion what could be the problem?
Thank you
My code:
var sessionOptions = new SessionOptions
{
    Protocol = Protocol.Webdav,
    HostName = "***.net",
    UserName = "***",
    Password = "***",
    PortNumber = 443,
    WebdavSecure = false,
};
using (var session = new Session())
{
    session.Open(sessionOptions);
    ...
}

Reply with quote

Advertisement

rl
Joined:
Posts:
2

Re: Connection failed when trying to open a session

Hi, Thank you for your reply.
I generated the code, and now I get "404 Not Found" error for Session.Open.
I checked the "Logging" in the GUI, but couldn't find log files.

My code:
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Webdav,
    HostName = "x",
    UserName = "xx",
    Password = "xxx",
    WebdavSecure = true,
    TlsHostCertificateFingerprint = "7e:5c:.....",
};
 
using (WinSCP.Session session = new WinSCP.Session())
{
    // Connect
    session.Open(sessionOptions);
}
Thanks

Reply with quote

Guest

Re: Connection failed when trying to open a session

Indeed, the RootPath was missing, it's working now.
Thank you!
As for the WebdavSecure = true, it seems that it did fix it.

Reply with quote

Advertisement

You can post new topics in this forum