Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

Confirmed Martin, if I close my application's log file before calling your Open method and then open the log file again, everything works fine.
For your information, I have this log file open with the LOCK APPEND property, in case it helps you in the future.
Thank you very much for your help Martin, it has been very helpful.
ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

Wait Martin, I have found a possible cause on my part, related to the open files to debug the main program.

It seems that after calling the open of the winscpnet.dll, it affects the open files of my main program, since they will not be left with the same state.
If I disable my log file, everything works fine from the Windows service.
ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

Martin, I need your help to solve it.

In this case, I'm executing this code:
Set mySession = New winscpnet.Session
Set mySessionOptions = New winscpnet.SessionOptions
Set myTransferOptions = New winscpnet.TransferOptions
mySession.SessionLogPath = "C:\Log\WinSCP[SessionLogPath][Usuario].log"
mySession.DebugLogLevel = -1
mySession.DebugLogPath = "C:\Log\WinSCP[DebugLogPath][Usuario].log"
mySessionOptions.protocol = Protocol_Ftp
mySessionOptions.FtpMode = winscpnet.FtpMode_Passive
myTransferOptions.TransferMode = winscpnet.TransferMode.TransferMode_Binary
With mySessionOptions
    .HostName = "184.107.41.132"
    .UserName = "fotos@esp01.aal-erp.com"
    .PassWord = "xxxx"
    .PortNumber = 21
End With
mySession.Open mySessionOptions

Does the log that I have sent you give you any clue as to what is happening?
ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

The cause of the [Session is already opened] error was because after mySession.Open, I reassigned mySession.SessionLogPath and mySession.DebugLogPath again. This was my error when activating debugging and it did not let us see the following error, that is when we try to connect from the Windows Service, it hangs (similar to the another post to SFTP).

I have attached updated logs with a level of detail 2.

I think we are close to solving it. ;)

Thanks a lot Martin !!!
ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

Ok, I will check.
I will tell you something. Thanks a lot!
martin

Re: WinSCPnet Error -2146233079 Session is already opened

The debug log shows that the exception is thrown because you are trying to set (again?) Session.SessionLogPath after calling Session.Open.

Also your session and debug logs strangely do not match each other.
ToniJ

Re: WinSCPnet Error -2146233079 Session is already opened

Hi, first of all, I apologize for the delay in responding and now I return to this topic, without leaving it.
I attach session log and debug log.
I use WinSCP 5.19.6 (.NET assembly – COM Library)

Thanks for advance.
Toni.
martin

Re: WinSCPnet Error -2146233079 Session is already opened

Please post session and debug logs.

Though Session.ListDirectory never throws "Session is already opened" error.
ToniJ

WinSCPnet Error -2146233079 Session is already opened

My application in VB6 uses successfully WinSCPnet.dll for connect to FTP.
With a certain FTP that has 12471 files in the root folder, this error appears when requesting the list of files.
It connect fine, but in this point:
Dim directory As winscpnet.RemoteDirectoryInfo
Set directory = mySession.ListDirectory("/")


-2146233079 Session is already opened

With other FTP, it works fine.

Any idea?

Thanks.