Initialize fails on UPnPNATManager

I am using the sample code and when I run it fails on the Initialize method call as below.

Dim objUPnP As sfFTPLib.UPnPNATManager
objUPnP = New sfFTPLib.UPnPNATManager

The stack trace is below. If someone could offer some wisdom as to why this is happening I'd greatly appreciate it.


System.Runtime.InteropServices.COMException was unhandled
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
at sfFTPLib.UPnPNATManagerClass.Initialize()
at BTS.PC.FTP.Init() in C:\Users\dmatthews\Local Projects\BTS.PC.Importer\BTS.PC.FTP\FTP.vb:line 184
at BTS.PC.FTP.SecureFTP(Object sourceFTPDirectory) in C:\Users\dmatthews\Local Projects\BTS.PC.Importer\BTS.PC.FTP\FTP.vb:line 51
at BTS.PC.Importer.FTPSender.SendFile(Object sender, FileSystemEventArgs e) in C:\Users\dmatthews\Local Projects\BTS.PC.Importer\FTPSender\FTPSender.vb:line 130
at System.IO.FileSystemWatcher.OnCreated(FileSystemEventArgs e)
at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action, String name)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

There is probably no UPnP capable device available. Catch the exception and ignore it.

There is probably no UPnP capable device available. Catch the exception and ignore it.
Thanks but when I ignore it I get an 'ftpErrorConnect' as LastError.

I have set the Host, Port, Username and Password and I can ping the target Host.


Set the LogFile.File property. Then take a look at the generated log file.