Hello,
I need to deploy an SFTP server as a service backed by Azure Blob storage. For this purpose, using the Rebex FileServer component, I'm implementing a virtual file system which is bridging the blob storage (currently using development storage provided by Azure Storage Emulator).
The streaming works fine while uploading to the server, but I receive a "Seek fault" error when downloading; the BlobReadStream is beeing seeked beyond its length (ArgumentOutOfRangeException: The argument 'offset' is larger than maximum of '119166'). Both the stream's length and GetLength(NodeBase node)
return the correct value. If I download the whole blob(e.g. in a MemoryStream), it works fine, but this approach is not feasible as we are dealing with large files, of several gigabytes.
Here are some lines of code:
protected override NodeContent GetContent(NodeBase node, NodeContentParameters contentParameters)
{
Stream stream;
NodeContent nodeContent;
switch (contentParameters.AccessType)
{
case NodeContentAccess.Read:
stream = _azureFS.OpenFileRead(node.Path.StringPath);
nodeContent = NodeContent.CreateReadOnlyContent(stream);
break;
default:
//....
break;
}
return nodeContent;
}
public Stream OpenFileRead(string path)
{
CloudBlockBlob blob = GetCloudBlob(path);
if (blob == null)
return null;
Stream stream = blob.OpenRead();
return stream;
//MemoryStream ms = new MemoryStream();
//blob.DownloadToStream(ms);
//ms.Seek(0, SeekOrigin.Begin);
//return ms;
}
And the call stack:
Connecting through either FileZilla or WinSCP produces the same outcome.
What am I missing?
Thanks a lot,
Paula