Error 2146233321 Automation error
I created a VB6 application to transfer files via SFTP.
I downloaded WinSCP.exe, WinSCPnet.dll and use the following to register the dll for COM type library:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe WinSCPnet.dll /codebase /tlb
In my VB6 application, I add a reference to WinSCPnet.tlb, the VB6 application works fine in test environment(Windows Server 2003), but I got -2146233321 Automation error when I deploy into Production environment(Windows Server 2003), this error occurs when trying to create SessionOptions object as shown below:
Private Sub cmdCreateSession_Click()
On Error GoTo Err_Handler
Dim mySessionOptions As New SessionOptions
' Setup session options
With mySessionOptions
.Protocol = Protocol.Protocol_Sftp
.HostName = txtRemoteHost
.UserName = txtUserName
.Password = txtPassword
.SshHostKeyFingerprint = txtFingerPrint
End With
' Connect
Set gSession = New Session
gSession.Open mySessionOptions
MsgBox "Session is created successfully"
Exit Sub
Err_Handler:
MsgBox Err.Number & ":" & Err.Description
Exit Sub
End Sub
But it works fine when I run debug in production environment, I only get this error when I run .exe from Production environment.
Does anyone have any idea about this error?
I downloaded WinSCP.exe, WinSCPnet.dll and use the following to register the dll for COM type library:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe WinSCPnet.dll /codebase /tlb
In my VB6 application, I add a reference to WinSCPnet.tlb, the VB6 application works fine in test environment(Windows Server 2003), but I got -2146233321 Automation error when I deploy into Production environment(Windows Server 2003), this error occurs when trying to create SessionOptions object as shown below:
Private Sub cmdCreateSession_Click()
On Error GoTo Err_Handler
Dim mySessionOptions As New SessionOptions
' Setup session options
With mySessionOptions
.Protocol = Protocol.Protocol_Sftp
.HostName = txtRemoteHost
.UserName = txtUserName
.Password = txtPassword
.SshHostKeyFingerprint = txtFingerPrint
End With
' Connect
Set gSession = New Session
gSession.Open mySessionOptions
MsgBox "Session is created successfully"
Exit Sub
Err_Handler:
MsgBox Err.Number & ":" & Err.Description
Exit Sub
End Sub
But it works fine when I run debug in production environment, I only get this error when I run .exe from Production environment.
Does anyone have any idea about this error?