Topic "Error 2146233321 Automation error"

Author Message
eddy.peng
[View user's profile]

Joined: 2015-04-13
Posts: 3
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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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?
_________________
Martin Prikryl
eddy.peng
[View user's profile]

Joined: 2015-04-13
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Try to inspect assembly loading with Assembly Binding Log Viewer (Fuslogvw.exe):
https://msdn.microsoft.com/en-us/library/e74a18c4.aspx

Also make sure that's only one version of the assembly registered on the production server.
eddy.peng
[View user's profile]

Joined: 2015-04-13
Posts: 3
prikryl wrote:
Try to inspect assembly loading with Assembly Binding Log Viewer (Fuslogvw.exe):
https://msdn.microsoft.com/en-us/library/e74a18c4.aspx

Also make sure that's only one version of the assembly registered on the production server.




But I don't have Fuslogvw.exe in my environment(Windows 2003, VB6), I use WINSCPnet.tlb in VB6 application.

What else can I check?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.
_________________
Martin Prikryl
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