SessionLocalException on simple Session.Open in Azure function (C#)

Advertisement

gtrennert
Joined:
Posts:
1

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 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}");
        }
Exception documentation for details does not help very much
Could anybody help me?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,205
Location:
Prague, Czechia

Re: SessionLocalException on simple Session.Open in Azure function (C#)

What exception do you get? Give us full exception message. + How did you deploy your project to Azure function?

Your duplicate question on Stack Overflow:
https://stackoverflow.com/q/69383674/850848

Reply with quote

Advertisement

You can post new topics in this forum