Windows 8 Metro App文件共享访问 [英] Windows 8 Metro App File Share Access

查看:96
本文介绍了Windows 8 Metro App文件共享访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发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信息:无法访问指定的文件(\\ domain \ path \ JDrive).验证清单中是否声明了与此文件类型相关的文件类型关联,并且该文件未标记有系统或隐藏文件属性.

WinRT information: Cannot access the specified file (\\domain\path\JDrive). 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:

  • 企业认证
  • Internet(客户端)
  • 专用网络(客户端和服务器)

我们的应用程序没有声明

Our app has no Declarations

对于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 Service访问文件共享来解决此问题.它远非理想,但可以满足我们的需求.

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 App文件共享访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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