Topic "VB.NET: "The file exists." error while opening Session"

Author Message
Suresh
[View user's profile]

Joined: 2013-10-02
Posts: 5
Location: Malaysia
Hi,

I developed an VB.NET application to monitor the files in SFTP folder periodically. The application uses Winscp.dll. I am using Windows Task scheduler and called the application.

I am getting following error while connecting WinScp using Session.Open method.

Code Snippet

Code:
Imports WinSCP

Try

   WriteInLogFile("Process Starts...")
   Dim sessionOptions As New SessionOptions
   With sessionOptions
        .Protocol = Protocol.Sftp
        .HostName = HostName
        .PortNumber = PortNumber
        .UserName = UserName
        .Password = Password
        .SshHostKey = SSHHostKey
    End With
         
   Using session As Session = New Session
      session.Open(sessionOptions)
      
      WriteInLogFile("Session starts...")
       
      Dim directory As RemoteDirectoryInfo = session.ListDirectory(SourcePath & FileType)
      ...
      
      WriteInLogFile("Process Ends...")
   End Using
            
Catch e As Exception
     WriteInLogFile("Error : " & e.Message.ToString)
End Try


Error

Error : The file exists.

The scheduler is running in local Adminstrator account.

Windows Server Details

Windows Server 2008 R2 Enterprise- 64 bit OS

WinSCP

WinSCP 5.0.6 (Build 2074)

Kindly note that the Session opened properly when the same application executed manually by double clicking the exe.

Since the application is working fine when we execute manually and also the error message is not proper, we are unable to proceed our analysis.

Kindly suggest possible causes for this scenario and provide me a solution.

Thanks

Suresh
Suresh
[View user's profile]

Joined: 2013-10-02
Posts: 5
Location: Malaysia
Hi,

After I clear the temp folder, the scheduler is working fine.

Ref: http://winscp.net/forum/viewtopic.php?t=11184

But I wonder, why Winscp creates temp files in temp folder and why this problem is not occurred while executing the application manually.

Kindly let me know if anyone has information regarding this.

Thanks & Regards
Suresh
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Suresh wrote:
After I clear the temp folder, the scheduler is working fine.

Ref: http://winscp.net/forum/viewtopic.php?t=11184

This was know bug:
http://winscp.net/tracker/show_bug.cgi?id=849
You need to upgrade.

Quote:
But I wonder, why Winscp creates temp files in temp folder

This is how it communicates with winscp.exe

Quote:
and why this problem is not occurred while executing the application manually.

Possibly your interactive session uses a different temp folder than your schedulers session.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License