StartAsync()引发错误System.IO.FileNotFoundException以进行下载

时间:2015-03-09 16:11:05

标签: c# windows windows-runtime

我正在尝试Windows 8.1的后台下载程序。这是我从Background Downloader示例中获得的HandleDownloadAsync()

它开始获得FileNotFound Exception await download.StartAsync().AsTask(cts.Token, progressCallback);

几天前工作了,我没有改变代码。所有变量也分配了正确的值。

有什么问题?

async void HandleDownloadAsync(DownloadOperation download, bool start)
{
    activeDownloads.Add(download);
    try
    {
        Progress<DownloadOperation> progressCallback = new Progress<DownloadOperation>(ProgressCallback);
        if (start)
        {
            await download.StartAsync().AsTask(cts.Token, progressCallback);
        }
        else
        {
            await download.AttachAsync().AsTask(cts.Token, progressCallback);
        }

    }
    catch (Exception ex)
    {
    }
    finally
    {
        activeDownloads.Remove(download);
    }
}

0 个答案:

没有答案