DeleteAsync错误:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED)) [英] DeleteAsync error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

查看:153
本文介绍了DeleteAsync错误:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我在WinRT C#工作。我有一个类下载10个7-Zip文件,解压缩然后尝试删除不再需要的原始文件。它删除较小的文件,但不删除较大的文件(只有一个兆左右),我甚至无法删除最后一个使用资源管理器尝试手动删除它,因为它说它仍在使用中。删除最后一个的唯一方法是关闭应用程序。代码很简单:

I am working in WinRT C#. I have a class that downloads 10 7-Zip files, decompresses them then tries to delete the original files that are no longer needed. It deletes the smaller files but does not delete the larger ones (only a meg or so) and I can't even delete the last one using Explorer trying to manually delete it because it says it's still in use. The only way to delete that last one is to close the app. The code is simple:

 

                StorageFile file = await CreateOutputFile(fileName, path);

                MemoryStream theMemStream = new MemoryStream();

                theMemStream.Write(bytes, 0, bytes.Length);

                await FileIO.WriteBytesAsync(file, bytes);

                var result = await unZipFile(file, path);

                try
                {
                    if (file != null)
                    {
                        await file.DeleteAsync();
                        file = null;
                    }
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }

 

 

 

 

 

 

 

推荐答案

我猜unZipFile中的某些运算符未完成导致此问题。

I guess some operator in unZipFile not are not finished caused this issue.

请检查unZipFile代码,在文件中存储或保存流。

Please check the unZipFile codes, to store or save stream in files.

最好的问候,

Jesse

Best regards,
Jesse


这篇关于DeleteAsync错误:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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