Silverlight 4.0 FileStream [英] Silverlight 4.0 FileStream

查看:64
本文介绍了Silverlight 4.0 FileStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);

参数:<<路径>>调试资源 字符串不可用.通常是钥匙 和论点提供足够的 诊断问题的信息. 看 http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.41108.0&File=mscorlib.dll&Key=FileSecurityState_OperationNotPermitted

Arguments: << path >> Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.41108.0&File=mscorlib.dll&Key=FileSecurityState_OperationNotPermitted

上面的代码行有一个错误[FileSecurityState_OperationNotPermitted]

The line of code above has an error [FileSecurityState_OperationNotPermitted]

推荐答案

听起来您的应用程序正在部分信任状态下运行.要使用FileStream,您需要请求升高信任:

It sounds like your application is running in partial trust. To use a FileStream, you'll need to request elevated trust:

默认情况下,基于Silverlight 应用程序以部分信任的方式运行, 这意味着它们在安全范围内运行 沙箱.沙盒应用程序有 限制访问本地 电脑,并受制于其他 防止恶意的方法 行为.

By default, Silverlight-based applications run in partial trust, which means they run within a security sandbox. Sandboxed applications have restricted access to the local computer and are constrained in other ways that help prevent malicious behavior.

从Silverlight 4 FileStream文档(重点是我的):

From the Silverlight 4 FileStream documentation (emphasis mine):

由高信任度调用时 应用程序,公开了一个流 一个文件,同时支持同步 和异步读写 操作.

When it is called by an elevated-trust application, exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.

您可以通过在Silverlight项目设置中设置在浏览器外运行时要求提升的信任度"来将应用程序设置为要求提升的信任度.

You can set an application to require elevated trust by setting the "Require elevated trust when running outside the browser" in your Silverlight project settings.

这篇关于Silverlight 4.0 FileStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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