SessionLocalException on simple Session.Open in Azure function (C#)
Hello,
First I generated a simple console application to see if the generated by WinSCP works fine – and this was the case
Now I try to write an Azure function using WinSCP – in the same way – the same parameters – and I get an exception on
My code:
Exception documentation for details does not help very much
Could anybody help me?
First I generated a simple console application to see if the generated by WinSCP works fine – and this was the case
Now I try to write an Azure function using WinSCP – in the same way – the same parameters – and I get an exception on
Session.Open
(SessionLocalException
)
My code:
public static async Task<IActionResult> WriteFile( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req) { SessionOptions sessionOptions = new SessionOptions { Protocol = Protocol.Sftp, HostName = "xxx", UserName = "xxx", Password = "xxx", SshHostKeyFingerprint = "xxx", }; using (Session session = new Session()) { try { session.Open(sessionOptions); } catch (SessionLocalException) { content = JsonConvert.SerializeObject(new { success = false, exception = "SessionLocalException", condition = "Error communicating with winscp.com. See the exception documentation for details." }); return (ActionResult)new OkObjectResult($"{content}"); }
Could anybody help me?