.NET 4.0 - wodSSHTunnel assembly error - WeOnlyDo Discussion board

.NET 4.0 - wodSSHTunnel assembly error (wodSSHTunnel)

by Mike, Monday, October 20, 2014, 21:19 (3448 days ago)

Is the wodSSHTunnel library compatible with .NET 4.0 and higher? I keep getting errors when trying to create and connect to a tunnel from within a WPF application.

The sample application are written in WinForms, is there any reason these assemblies would not load in an WPF application?

.NET 4.0 - wodSSHTunnel assembly error

by Jasmine, Monday, October 20, 2014, 21:56 (3448 days ago) @ Mike

Hi Mike

Can you be more specific? What errors do you get?

Jasmine.

.NET 4.0 - wodSSHTunnel assembly error

by Mike, Tuesday, October 21, 2014, 00:21 (3448 days ago) @ Jasmine

It seems the sample using ActiveX winform library running on .NET version 2.0. This causes the following errors in my .NET 4.0 console project.

The type 'System.Windows.Forms.AxHost' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

The Interop library does not allow the 'Copy Local' option to be set to true, so this error occurs.

Additional information: Could not load file or assembly 'Interop.wodSSHTunnelLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

When I copy the Interop.wodSSHTunnelLib.dll to the DEBUG folder in the bin directory i get the following error when running.

An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll Additional information: ActiveX control 'a2aad48e-67e5-448e-a889-d60e7f642dbd' cannot be instantiated because the current thread is not in a single-threaded apartment.

This is all because i'm using the winforms example for the wodTunnel

new AxwodSSHTunnelLib.AxwodTunnel()

when i should be using the example tunnel found here.

wodSSHTunnelCOMLib.wodTunnelCom wodSSHTunnel1;


http://www.weonlydo.com/code.asp?did=SOCKS-proxy-over-SSH-

But I cannot find the following required tunnel library anywhere. Where would i find this assembly??
Interop.wodSSHTunnelCOMLib.dll

.NET 4.0 - wodSSHTunnel assembly error

by Jasmine, Tuesday, October 21, 2014, 10:16 (3447 days ago) @ Mike

Hi Mike.

My suggest is to use COM instead of OCX.

wodSSHTunnel comes in 3 flavors - wodTunnel.DLL (the COM object), wodTunnel.OCX (the ActiveX control), and wodTunnel.EXE (out-of-proc COM object).

I suggest you find wodTunnel.DLL instead and try with that one.

Jasmine.

.NET 4.0 - wodSSHTunnel assembly error

by Mike, Tuesday, October 21, 2014, 15:21 (3447 days ago) @ Jasmine

Ok, i will try that. I found this assembly in my Windows/System32 which was a bit hard to locate. The SSH.NET project has an assembly folder with shortcuts to all relevant DDL files. My only suggestion to have a similar folder for the SSHTunnel project.

.NET 4.0 - wodSSHTunnel assembly error

by Jasmine, Tuesday, October 21, 2014, 16:45 (3447 days ago) @ Mike

Hi Mike.

Actually it is common for COM/ActiveX to go to SYSTEM32 (SYSWOW64) since they are shared system-wide.

.NET assemblies, on the other hand, are not registered with the system and are app-specific, and as such can go to app's folder.

Jasmine.

.NET 4.0 - wodSSHTunnel assembly error

by Mike, Tuesday, October 21, 2014, 22:36 (3447 days ago) @ Jasmine

that is clear now, but it wasn't when i was going through the examples.

So i am using the COM library in a simple console .NET 4.0 application, i setup the code base as in the following example. I can run the sample WinForm ActiveX and create the tunnel, but get an error with the COM.


When i try to open the channel it will silently fail and close the console down. I was able to grab one exception below.

http://www.weonlydo.com/code.asp?did=Tunneling-HTTP-over-SSH
wodSSHTunnel1.Channels.Add(wodSSHTunnelCOMLib.ForwardTypesEnum.LocalListen, "127.0.0.1", 80, "0.0.0.0", 80);
{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} System.Exception {System.Runtime.InteropServices.COMException}

.NET 4.0 - wodSSHTunnel assembly error

by Jasmine, Tuesday, October 21, 2014, 23:25 (3447 days ago) @ Mike

Hi Mike.

Can you please zip your project and send it to techsupport so we can try it out?

I believe error you're getting is actual COM error returned by wodSSHTunnel, not generic "unable to use COM" kind of error. But we'd like to duplicate this to give you better answer on what could be wrong.

Jasmine.