FTP下载后台传输 [英] FTP download in background transfer
问题描述
我正在使用以下代码(后台传输)从ftp服务器下载:
I am using the following code ( background transfer) to download from an ftp server:
task< ; StorageFile ^>(文件夹 - > CreateFileAsync(file_name,CreationCollisionOption :: ReplaceExisting))
.then([this](StorageFile ^ file)
  ; {
BackgroundDownloader ^ bd = ref new BackgroundDownloader();
if(bd)
{
DownloadOperation ^ loader_op = bd-> CreateDownload(ref new Uri(FTPUrl),file);
; if(loader_op)
{
IAsyncOperationWithProgress< DownloadOperation ^,DownloadOperation ^> ^ async;
async = loader_op-> StartAsync();
if(async)
{
task< DownloadOperation ^>(async,CancellationToken-> get_to ken())。then([this](DownloadOperation ^ download)
{
ResponseInformation ^ response = download-> GetResponseInformation();
if(200 == response-> StatusCode)
{
// 下载完成
}
else
{
}
task<StorageFile^>(folder->CreateFileAsync(file_name, CreationCollisionOption::ReplaceExisting))
.then([this](StorageFile^ file)
{
BackgroundDownloader^ bd = ref new BackgroundDownloader( );
if( bd )
{
DownloadOperation^ loader_op = bd->CreateDownload( ref new Uri(FTPUrl), file );
if( loader_op )
{
IAsyncOperationWithProgress<DownloadOperation^, DownloadOperation^>^ async;
async = loader_op->StartAsync();
if( async )
{
task<DownloadOperation^>(async, CancellationToken->get_token()).then([this] (DownloadOperation^ download)
{
ResponseInformation^ response = download->GetResponseInformation();
if( 200 == response->StatusCode )
{
// download complete
}
else
{
}
})。then([this,loader_op](task< void> previousTask)
{
尝试
{
previousTask.get();
}
catch(Exception ^ ex)
{
}
});
$
; }
}
}).then([this, loader_op] (task<void> previousTask)
{
try
{
previousTask.get();
}
catch (Exception^ ex)
{
}
});
}
}
}
}
}) ;
});
但是片刻之后,代码会抛出异常跟随g错误:
But after a short while the code throws exception with the following error:
" Download.exe中0x50B38AE3(msvcr110d.dll)的未处理异常:将无效参数传递给认为无效参数致命的函数。"错误发生在文件invarg.c中。我附上了此文件
中确切位置的屏幕截图,其中发生错误:
"Unnhandled exception at 0x50B38AE3 (msvcr110d.dll) in Download.exe: An invalid parameter was passed to a function that considers invalid parameters fatal." The error is in the file invarg.c . I have attached a screenshot of the exact place in this file where the error occurs:
我之前发布了一个类似的问题,并被告知FTP下载中的Release Preview存在错误。是否有任何修复? 以上代码可以与http服务器一起正常工作。
I had posted a similar question regarding this previously and was informed that there was a bug in Release Preview in FTP download. Any fixes? The above code works fine with http server.
我希望根据上一个回复线程对此进行修复:
I hope there is a fix to this according to the last reply to the below thread :
推荐答案
你好,
看起来你偶然发现了一个新问题。我们目前正在内部跟踪此事。我已联系负责该组件的团队。如果我从他们那里听到任何有趣的消息我会告诉你。
It looks like you have stumbled on a new issue. We are currently tracking this internally. I have contacted the team responsible for the component. If I hear anything interesting from them I will let you know.
谢谢,
詹姆斯
>
这篇关于FTP下载后台传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!