Windows 8 Metro App File Share Access(Windows 8 Metro 应用程序文件共享访问)
问题描述
我正在开发一个 Windows 8 Metro 应用程序,我们打算将它部署到我们公司内的几台平板电脑上.它不适用于 Windows 应用商店.
I am developing a Windows 8 Metro app, and we intend to deploy it to only a few tablets within our company. It's not meant for the Windows Store.
我们需要应用访问公司网络共享上的一些目录,但强制用户使用 FilePicker
并不是我们想要的.
We need the app to access some directories on the company's network share, but forcing the user to use a FilePicker
isn't what we want.
我们的第一次尝试是使用 await StorageFolder.GetFolderFromPathAsync("J:\");
.这不起作用,并产生了以下异常:
Our first attempt was to use await StorageFolder.GetFolderFromPathAsync("J:\");
. This didn't work, and produced the following exception:
System.UnauthorizedAccessException"类型的未处理异常发生在mscorlib.dll
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
WinRT 信息:无法访问指定的文件或文件夹 (J:).该项目不在应用程序可以访问的位置(包括应用程序数据文件夹、可通过以下方式访问的文件夹StorageApplicationPermissions 中的功能和持久化项目列表).验证该文件未标记系统或隐藏文件属性.
WinRT information: Cannot access the specified file or folder (J:). The item is not in a location that the application has access to (including application data folders, folders that are accessible via capabilities, and persisted items in the StorageApplicationPermissions lists). Verify that the file is not marked with system or hidden file attributes.
附加信息:访问被拒绝.(HRESULT 的例外情况:0x80070005 (E_ACCESSDENIED))
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
所以我们尝试将 "J:"
替换为驱动器映射到的网络路径.这也不起作用,我们得到了这个异常:
So we tried replacing "J:"
with the network path the drive was mapped to. This also didn't work, and we got this exception:
在 mscorlib.dll 中发生了System.UnauthorizedAccessException"类型的未处理异常
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
WinRT 信息:无法访问指定的文件 (\domainpathJDrive).验证是否在清单中为此类文件声明了文件类型关联,并且该文件未标记系统或隐藏文件属性.
WinRT information: Cannot access the specified file (\domainpathJDrive). Verify that there is a file type association declared in the manifest for this type of file and that the file is not marked with the system or hidden file attributes.
附加信息:访问被拒绝.(来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
我们的应用具有以下功能:
Our app has the following Capabilities:
- 企业认证
- 互联网(客户端)
- 私有网络(客户端和服务器)
我们的应用没有声明
这对于 Windows 应用商店应用来说是非常合理的,但是对于不进入应用商店的简单内部应用是否有任何解决方法?
This is all very reasonable for a Windows Store app, but is there any workaround for a simple in-house app that isn't going to the Store?
推荐答案
我们目前正在通过 WCF Web 服务
访问文件共享来解决这个问题.它远非理想,但它为我们提供了我们需要的东西.
We're currently working around this by accessing the file share through a WCF Web Service
. It's far from ideal, but it gets us what we need.
这篇关于Windows 8 Metro 应用程序文件共享访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Windows 8 Metro 应用程序文件共享访问
基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01