写入InstalledLocation遇到的文件“Access is Denied” (0X80070005)! [英] Write to the file in the InstalledLocation encounter "Access is Denied" (0x80070005)!
本文介绍了写入InstalledLocation遇到的文件“Access is Denied” (0X80070005)!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在InstalledLocation中读取文件工作正常,但无法写入此文件。
Read file in the InstalledLocation works fine, but can't write to this file.
如何修复这个问题?
StorageFolder folder = Package.Current.InstalledLocation.
GetFolderAsync(@"Settings").AsTask().Result;
StorageFile file = folder.GetFileAsync(@"Settings.json").AsTask().Result;
string jsonString = FileIO.ReadTextAsync(file).AsTask().Result;
var rootObject = JsonObject.Parse(jsonString);
rootObject["set1"]= JsonValue.CreateStringValue("ok");
FileIO.WriteTextAsync(file, rootObject.Stringify()).AsTask().Wait();
推荐答案
在你的问题中,你正试图写入安装目录,它会给出错误。此行为是预期的。因为应用程序的安装目录是只读位置。这在文档中提到:应用程序
安装目录。您可以参考此文档以获取有关文件访问权限的更多信息。
In you question, you are trying to write into the install directory and it gives the error. This behavior is expected. Because the app's install directory is a read-only location. This is mentioned in the document here:Application install directory. You could refer this document for more information about file access permissions.
祝您好运,
Roy
这篇关于写入InstalledLocation遇到的文件“Access is Denied” (0X80070005)!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文