Error 2146233321 Automation error

Advertisement

eddy.peng
Joined:
Posts:
3

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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Error 2146233321 Automation error

eddy.peng wrote:

But it works fine when I run debug in production environment, I only get this error when I run .exe from Production environment.
Are you running the .exe using the same local account?

Reply with quote

eddy.peng
Joined:
Posts:
3

Yes, I'm using the same local account to run .exe and to debug.

I also tried to take the image of production machine and restore it into test network, the .exe works fine, when we restored the image back to production network, I got the same error when it tries to create SessionOptions object.

It really puzzles me and it's just not working in production network.

Your help is highly appreciated.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

eddy.peng wrote:

But I don't have Fuslogvw.exe in my environment(Windows 2003, VB6), I use WINSCPnet.tlb in VB6 application.
So download it. It's part of Windows SDK.

Reply with quote

Advertisement

You can post new topics in this forum