HRESULT 0x80072EE4 when using BackgroundDownloader

2019-05-05 02:40发布

Every time when I call CreateDownload on a BackgroundDownloader in my C# code for a Windows Store application, I get the following exception: Exception from HRESULT: 0x80072EE4. I have declared all necessary capabilities in my package file.

Example This code breaks when CreateDownload() is called:

public static async void DownloadFile(string url){
    var uri = new Uri(url, UriKind.Absolute);            
    FileSavePicker openPicker = new FileSavePicker();
    openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;            
    openPicker.FileTypeChoices.Add("Video file", new List<string>() { ".mp4" }); 
    StorageFile file = await openPicker.PickSaveFileAsync();
    if (file != null)
    {
        DownloadOperation downloader = new BackgroundDownloader().CreateDownload(uri, file); //BREAKS HERE            
        //... (rest of code)
    }
}

Exception This is the exact exception I get:

System.Exception was unhandled by user code
  HResult=-2147012892
  Message=Exception from HRESULT: 0x80072EE4
  Source=Windows.Networking
  StackTrace:
   at Windows.Networking.BackgroundTransfer.BackgroundDownloader.CreateDownload(Uri uri, IStorageFile resultFile)
       at Example.BlankPage1.<DownloadFile>d__1.MoveNext()
  InnerException: 

When I try to run the Windows 8.1 Background Transfer sample, I get the same exception at the same method.

When Googling on 0x80072EE4, it is suggested that moving Temporary Internet Files would solve the issue. In my case, it didn't work.

2条回答
干净又极端
2楼-- · 2019-05-05 03:27

For me, I received this error with the SSL certificate was invalid on the site I was trying to access.

Specifically: NET::ERR_CERT_AUTHORITY_INVALID

When I resolved the SSL certificate - the background downloader no longer had that error.

查看更多
相关推荐>>
3楼-- · 2019-05-05 03:36

I know this is an old question, but still, I guess I just found some input for what it's worth.

I was getting the HRESULT: 0x80072EE4 error after removing all permissions for the windows user/account that (I guess) my app is using for writing temp files when using background-downloader (and probably other stuff).

Check the permissions on the "{userAccount}\AppData\Local\Packages{yourAppName}\AC" folder, and specifically the "BackgroundTransferApi" folder in there, and make sure that there is an account named something like "S-1-15-2-.......{veryLongString}" and that it has all the permissions set.

Hope this helps some future visitor :)

查看更多
登录 后发表回答