ASP.Net 中等信任设置

发布于 2024-07-07 05:24:34 字数 487 浏览 9 评论 0原文

我正在尝试将 IPermission 节点配置为中等信任的一部分。 但是,我无法在节点上找到 PathDiscovery 属性的有效值列表,

<IPermission class="FileIOPermission" version="1" Read="$AppDir$" Write="$AppDir$" Append="$AppDir$" PathDiscovery="$AppDir$"/>

我需要设置权限,以便帐户能够访问主路径下的所有子目录。 目前,.svc(WCF 服务文件)会引发 404 错误,因为 ASP.Net 帐户无法从几层深度的子文件夹中获取它。 我试图避免将节点更改为

<IPermission class="FileIOPermission" version="1" Unrestricted="true"/>

Any ideas?

TIA

I am trying to configure the IPermission node as part of medium trust. However I am unable to find the valid values list for the PathDiscovery attribute on the node

<IPermission class="FileIOPermission" version="1" Read="$AppDir$" Write="$AppDir$" Append="$AppDir$" PathDiscovery="$AppDir$"/>

I need to set the permission so that the account will be able to access all subdirectories under the main path. currently a .svc (WCF service file) throws a 404 error because the ASP.Net account is not able to get it from a sub-folder couple of levels deep. I am trying to avoid changing the node to

<IPermission class="FileIOPermission" version="1" Unrestricted="true"/>

Any ideas?

TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饭团 2024-07-14 05:24:34

我当然同意您不应该将节点更改为不受限制,因为这几乎会破坏部分信任的目的。

根据 System.Security.Permissions.FileIOPermission 文档MSDN,FileIOPermission 也应该暗示对该路径下的所有内容的权限。
来自该文档:

访问文件夹意味着访问
它包含的所有文件,以及
访问所有文件和文件夹
它的子文件夹。 例如,阅读
访问 C:\folder1\ 意味着读取
访问C:\folder1\file1.txt,
C:\文件夹1\文件夹2\,
C:\folder1\folder2\file2.txt 等
上。

当然,微软对构建自定义信任 .config 文件的记录非常糟糕,因此 FileIOPermission 的 .config 标记的行为可能与代码类不同......但这对我来说是令人惊讶的。

是否有可能是其他问题导致了 404? 仔细检查服务是否正在您期望的凭据下执行,并且路径是否正在正确评估...

I certainly agree that you shouldn't change the node to Unrestricted, as that would pretty much defeat the purpose of partial trust.

According to the System.Security.Permissions.FileIOPermission documentation on MSDN, FileIOPermission is supposed to imply permissions to everything below that path as well.
From that doc:

Access to a folder implies access to
all the files it contains, as well as
access to all the files and folders in
its subfolders. For example, Read
access to C:\folder1\ implies Read
access to C:\folder1\file1.txt,
C:\folder1\folder2\,
C:\folder1\folder2\file2.txt, and so
on.

Of course, building custom trust .config files is woefully poorly documented by Microsoft, so it's possible that the .config markup for FileIOPermission behaves differently than the code class... That would be surprising to me though.

Is it possible some other problem is causing the 404? Double-check that the service is executing under the credentials you'd expect, and that the path is being evaluated correctly...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文