尽管使用broadFileSystemAccess,访问仍被拒绝 [英] Access is denied despite using broadFileSystemAccess

查看:88
本文介绍了尽管使用broadFileSystemAccess,访问仍被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UWP杀死了我.....

计算机崩溃后,我不得不重新安装VisualStudio2017.现在,我在崩溃前运行良好的应用却无法运行.

按照MS文档中的说明,我一直在使用Package Manifest中的broadFileSystemAccess功能:

  xmlns:rescap ="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"IgnorableNamespaces ="rescap uap mp desktop4 iot2"> 

 <功能>< rescap:Capability Name ="broadFileSystemAccess"/></功能> 

这没问题,但是现在我得到一个带下划线的rescap:功能和编译警告名称空间'

由于是警告,因此编译时不会发生异常.但是,如果此清单代码不存在,应用程序将无法访问文件(拒绝访问).

我拒绝说坏话....有人知道是什么原因造成的吗?这是全新的VS2017安装.

谢谢!

好的,这是我的一些发现.

1.应用程序不得同时声明broadFileSystemAccess和其他三个文件系统功能中的任何一个.(图片,文档,下载)

来源: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/415d02da-eeb6-45b3-b6e2-946b124d14b0/broadfilesystemaccess-issue?forum=wpdevelop

2.这仅适用于 storageFile api而不适用于 File.Exists等 api

来源: https://docs.microsoft.com/en-gb/windows/uwp/packaging/app-capability-declarations

3.确保与其他两个答案一样启用了fileAccess:

来源: https://stackoverflow.com/a/57703368/2987066

4.我还发现,每次我开始调试(并且代码已更改)时,我都需要重新打开和关闭该设置,以使其正常工作

源:通过反复试验挫败地调试应用程序

感谢Microsoft提供的出色开发环境,它确实显示了开发人员非常喜欢开发您的应用程序,因为与竞争对手相比,您的商店蒸蒸日上.

UWP is killing me.....

I had to reinstall VisualStudio2017 after a computer crash. And now, my app that was working perfectly well before the crash refuses to work.

I've been using the broadFileSystemAccess capability in the Package Manifest, as per the instructions in the MS documentation:

 xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
 IgnorableNamespaces="rescap uap mp desktop4 iot2">

and

<Capabilities>
<rescap:Capability Name="broadFileSystemAccess" />
</Capabilities>

This worked no problem, but now I get an underlined rescap:Capability and the compile warning "The element 'Capabilities' in namespace 'http://schemas.microsoft.com/appx/manifest/foundation/windows10' has invalid child element 'Capability' in namespace .......

Since it's a warning, it compiles without a hickup. However, the application cannot access files (access denied) justa s if this manifest code wasn't there.

I'm holding back saying bad words.... anybody has any idea of what is causing this? It's a fresh VS2017 install.

Thanks!

解决方案

Ok so heres some of my findings.

1. an app must not declare both broadFileSystemAccess and any of the other three file-system capabilities. (Pictures, documents, downloads)

source: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/415d02da-eeb6-45b3-b6e2-946b124d14b0/broadfilesystemaccess-issue?forum=wpdevelop

2. This only works with the storageFile api NOT File.Exists etc api

source: https://docs.microsoft.com/en-gb/windows/uwp/packaging/app-capability-declarations

3. Make sure the fileAccess is enabled as with the other two answers:

source: https://stackoverflow.com/a/57703368/2987066

4. I also found that every time I started debugging (and the code had changed) I needed to turn that setting on and off again to get it to work

source: frustratingly debugging the application through trial and error

Thanks microsoft for your excellent development environment, it really shows how much developers love developing your apps as your store is really flourishing in comparison to your competitors... oh wait..

这篇关于尽管使用broadFileSystemAccess,访问仍被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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