使用 BackgroundDownloader 时的 HRESULT 0x80072EE4 [英] HRESULT 0x80072EE4 when using BackgroundDownloader
问题描述
每次当我在 Windows 应用商店应用程序的 C# 代码中对 BackgroundDownloader 调用 CreateDownload 时,我都会收到以下异常:Exception from HRESULT: 0x80072EE4
.我已经在我的包文件中声明了所有必要的功能.
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.
示例 调用 CreateDownload() 时,此代码会中断:
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:
当我尝试运行 Windows 8.1 后台传输示例时,我用同样的方法得到同样的异常.
When I try to run the Windows 8.1 Background Transfer sample, I get the same exception at the same method.
在0x80072EE4
上搜索时,建议移动 Internet 临时文件可以解决问题.就我而言,它不起作用.
When Googling on 0x80072EE4
, it is suggested that moving Temporary Internet Files would solve the issue. In my case, it didn't work.
推荐答案
我知道这是一个老问题,但仍然,我想我只是找到了一些关于它的价值的输入.
I know this is an old question, but still, I guess I just found some input for what it's worth.
在删除 Windows 用户/帐户的所有权限后,我收到了 HRESULT: 0x80072EE4 错误(我猜)我的应用程序在使用后台下载程序(可能还有其他东西)时用于写入临时文件.
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).
检查{userAccount}\AppData\Local\Packages{yourAppName}\AC"文件夹的权限,特别是其中的BackgroundTransferApi"文件夹,并确保有一个类似于S-"的帐户1-15-2-.......{veryLongString}" 并设置了所有权限.
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 :)
这篇关于使用 BackgroundDownloader 时的 HRESULT 0x80072EE4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!