Topic "WinScp .NET Uri Format Exception"

Author Message
yuriyl
[View user's profile]

Joined: 2014-06-21
Posts: 2
Location: United States
WinSCP Version:5.1.0
Transfer Protocol: SFTP
Using WinScp .NET Assembly through SQL Server 2008 CLR
SQL Server Instance: Windows Server 2008 R2
CLR Version: v2.0.50727

I work in an enterprise environment and I used WinSCP .NET library to create a small .NET project that would allow me to connect to an enterprise FTP server and list contents of a remote directory. I was able to do that successfully on my desktop but, my overall goal was to list those contents as a table in an SQL Server environment. I added some additional logic to my .NET project so that it can be used as a CLR table valued function in SQL Server. I saved my .dll along with WinSCP.dll and winscp.exe on my SQL Server instance and I was able to successfully register both assemblies. For testing purposes I left ftp server connection information hard coded (this is the same connection information that i was able to connect with on my desktop)
When i run my .NET project as a CLR table valued function in SQL Server I get the error shown at the bottom of this post.

FTP.getRemoteDirInfo is my .NET function

Error happens on Session.Open(SessionOptions)

I'm able to ping the ftp server that I'm trying to connect from SQL Server instance and I'm able to manually FTP files using WinSCP from SQL Server instance.


Msg 6522, Level 16, State 2, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "TVF_FTP_List":
System.UriFormatException: Invalid URI: The URI is empty.
System.UriFormatException:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at WinSCP.ExeSessionProcess..ctor(Session session)
at WinSCP.Session.Open(SessionOptions sessionOptions)
at FTP.getRemoteDirInfo(String UsrName, String Passwrd, String Host, String FTPprotocol, String SSHFingerPrint, String RemoteDir)
.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
This is probably a different manifestation of this issue:
https://winscp.net/tracker/show_bug.cgi?id=935

Please upgrade.
_________________
Martin Prikryl
yuriyl
[View user's profile]

Joined: 2014-06-21
Posts: 2
Location: United States
You are absolutely right, I downloaded version 5.5.4 of WinSCP.exe and WinSCPnet.dll and it works! Thank you, you saved me a lot of headache!
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