Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
18.2k views
in .NET FTP by
I just do this :

1- Add DLL referance
2- add using statments
using System.IO;
using com.enterprisedt.net.ftp;
3-decare it like this
FTPClient ftp = new FTPClient("applsrv2", 21);
4- run the form

the result is error says "Invalid PInvoke metadata format."

Nothing more.

Please any one can help in this.

Thanks,
Marei

14 Answers

0 votes
by (162k points)
edtFTPnet is compiled for .NET 1.1 ... this could be the problem

I just do this :

1- Add DLL referance
2- add using statments
using System.IO;
using com.enterprisedt.net.ftp;
3-decare it like this
FTPClient ftp = new FTPClient("applsrv2", 21);
4- run the form

the result is error says "Invalid PInvoke metadata format."

Nothing more.

Please any one can help in this.

Thanks,
Marei
0 votes
by (180 points)
Yes Thanks very much.
0 votes
by
edtFTPnet is compiled for .NET 1.1 ... this could be the problem


I get the same problem, but im running .net 1.1... What else could the problem be??
0 votes
by (340 points)
By the way - maybe it has something to do with the fact that my domain name is ftp.spotted-productions.com - Maybe the dash is causing a format error??

Ok - nevermind - i tried other ftpo addresses including ip addresses, but they all return the same error... I have also tried using a diffirent port.

Here is my code and stack trace:
ftpclient = New FTPClient("ftp.spotted-productions.com")

When i call the constructor, i get the following:
Invalid PInvoke metadata format.

at System.Net.OSSOCK.gethostbyname(String host)
at System.Net.Dns.GetHostByName(String hostName)
at System.Net.Dns.Resolve(String hostName)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(String remoteHost, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(String remoteHost)
at ImageCompressor.main.SaveFiles(Int32 mode)
0 votes
by (162k points)
Does the demo program work with your ftp server?
0 votes
by
Yes - just tried it and it works fine...
0 votes
by (340 points)
Ok - Ive tried a few things:
The demo works fine, both C# and VB versions...

I tried the following:
ftpclient = New FTPClient(New System.Net.IPAddress(19627151))

This gave me the following error:
Message: Invalid PInvoke metadata format.

Trace: at System.Net.OSSOCK.gethostbyname(String host)
at System.Net.Dns.GetHostByName(String hostName)
at System.Net.Dns.Resolve(String hostName)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(String remoteHost, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(String remoteHost)
at ImageCompressor.main.SaveFiles(Int32 mode)

Source: System


Then I treid these two, which both gave the same errors:
' Same as I used in the demo
ftpclient = New FTPClient("ftp.spotted-productions.com")

ftpclient = New FTPClient()


The errors they gave:
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll

Additional information: Error loading XML file c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

Then:
Message: The type initializer for "EnterpriseDT.Util.Debug.Logger" threw an exception.

Trace: at EnterpriseDT.Util.Debug.Logger.GetLogger(Type clazz)
at EnterpriseDT.Net.Ftp.FTPClient.InitBlock()
at EnterpriseDT.Net.Ftp.FTPClient..ctor(IPAddress remoteAddr, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(IPAddress remoteAddr)
at ImageCompressor.main.SaveFiles(Int32 mode)

Source: edtftpnet-1.1.4


Why would the demo work, and not my code??
0 votes
by (51.6k points)
I just noticed that one of the exceptions you listed indicates that you're using the 1.0 framework, i.e.
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll

Additional information: Error loading XML file c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.


Notice the version identifier "v1.0.3705". That means you're using version 1.0. edtFTPnet is compiled for 1.1 (which has a version identifier of "v1.1.4322"), however it can easily be recompiled for 1.0.

- Hans (EDT)
0 votes
by (340 points)
Well well... Guess i missed that... I actually do have the 1.1 framework installed, but i had the 1.0 before that, which may be causing the problem - Ill try uninstall version 1.0 or something to force it to use the 1.1 framework...

Thanks for you help and your sharp eyes! :D
0 votes
by (340 points)
Ok - i uninstalled the 1.0 framework and found that VS stopped working, because i only have vs 2002. So i HAVE to run 1.0 - Unfortunately for me, after uninstalling 1.0, i realised i dont have the framework setup files, so now im downloading... :(

Anyway - ive done some research on getting VS to use the 1.1 framwork, but ill get back to you once ive tried a few things... In the mean while, how do recompile the dll for 1.0?

Categories

...