来自HRESULT的异常:0x80072ee3 - backgrounddownloader winrt [英] Exception from HRESULT: 0x80072ee3 - backgrounddownloader winrt

查看:74
本文介绍了来自HRESULT的异常:0x80072ee3 - backgrounddownloader winrt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从ftp下载文件时出现以下错误。

发现System.Exception HResult = -2147012893消息=来自HRESULT的异常:0x80072EE3 Source = mscorlib StackTrace:at System.Runtime System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()上的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中的.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)





谁能告诉我我做错了什么?

提前致谢!



我尝试了什么:



以下是我使用的代码 -



I am getting below error when trying to download a file from ftp.
System.Exception was caught HResult=-2147012893 Message=Exception from HRESULT: 0x80072EE3 Source=mscorlib StackTrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()


can anyone tell me what am I doing wrong ?
Thanks in advance!

What I have tried:

Below is the code I am using-

public static async Task<bool> LargeDownLoad(string localsubfolders, string ftpURIInfo, string Username, string Password, string filename)
    {
        bool Successful = false;
        try
        {
            StorageFolder localFolderArea;
            BackgroundDownloader downloader = new BackgroundDownloader();
            // Open if exists as you cannot delete it if there are files in it.
            localFolderArea = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync(localsubfolders, CreationCollisionOption.OpenIfExists);

            // create a storagefile which combines the localFolderArea with the filename of the local file.
            StorageFile localFilePath = await localFolderArea.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);

            Uri urlWithCredential; // = new Uri(ftpURIInfo + "/" + filename);
            bool Success = Uri.TryCreate(ftpURIInfo + "/" + filename, UriKind.Absolute, out urlWithCredential);

            if (!string.IsNullOrEmpty(Username.Trim()) &&
               !string.IsNullOrEmpty(Password.Trim()))
            {
                urlWithCredential = new Uri(urlWithCredential.ToString().ToLower().Replace(@"ftp://",
                    string.Format(@"ftp://{0}:{1}@",
                    Username,
                    Password)));
            }

            DownloadOperation download = downloader.CreateDownload(
                urlWithCredential,
                localFilePath);
            await download.StartAsync();

            Successful = true;

        }
        catch (Exception)
        {
            throw;
        }
        return Successful;
    }

推荐答案

错误代码0x80072EE3 ERROR_INTERNET_EXTENDED_ERROR

从服务器收到错误响应时会发生此错误。



您可以尝试传递 HRESULT BackgroundTransferError.GetStatus | getStatus方法(Windows) [ ^ ]获取服务器错误代码。



请参阅 FTP服务器返回码列表 - 维基百科,免费的百科全书 [ ^ ]知道发生了什么。
Error code 0x80072EE3 is ERROR_INTERNET_EXTENDED_ERROR.
This error occurs when receiving an error response from the server.

You can try to pass the HRESULT to BackgroundTransferError.GetStatus | getStatus Method (Windows)[^] to get the server error code.

See then the List of FTP server return codes - Wikipedia, the free encyclopedia[^] to know what happened.


这篇关于来自HRESULT的异常:0x80072ee3 - backgrounddownloader winrt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆