来自网络共享的 .Net 2.0 应用程序,无需 FullTrust

发布于 2024-07-11 00:27:04 字数 224 浏览 10 评论 0原文

我正在尝试从网络共享运行 .Net 2.0 应用程序,而不使用 FullTrust 权限集。 我想创建一个新的权限集,其中仅包含我的程序集所需的权限,然后将其分配给共享路径上的 exe。 是否有可能做到这一点? 从我有限的实验来看,我发现如果没有 FullTrust,我无法让任何应用程序通过网络共享运行。 我尝试创建一个新的烫发集,也尝试了 Everything 和其他烫发集,但似乎都不起作用。 有没有人有这方面的经验?

I am trying to run a .Net 2.0 application from a network share without using the FullTrust permission set. I want to create a new permission set that has just the permissions my assemblies require, and then assign that to the exe on the shared path. Is it possible to do this?
From my limited experiments, I find that I am unable to do get any application working from a network share without FullTrust. I tried creating a new perm set, and also tried the Everything and other perm sets, but none seem to work. Has anyone had any experience with this?

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

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

发布评论

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

评论(3

乱了心跳 2024-07-18 00:27:04

您需要使用强名称对程序集进行签名,然后将强名称的 cas 策略设置为完全信任。

将 FullTrust 设置为使用您的强名称签名的所有代码的最简单方法是:

caspol.exe -q -m -ag MyZone -strong -hex [HexCodeOfYourStrongName] -noname -noversion FullTrust -name MyCode -description "Code trust for my code"';

如果您的代码分为多个程序集,则需要使用该强名称对每个程序集进行签名。 您可能需要使用链接需求设置SecurityPermission - 属性,以保证调用者的安全性。

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.ControlPrincipal)]

You need to sign your assemblies with a strong name and then set the cas-policy for your strong-name to full trust.

The easiest way for setting up FullTrust to all code signed with your strong-name is:

caspol.exe -q -m -ag MyZone -strong -hex [HexCodeOfYourStrongName] -noname -noversion FullTrust -name MyCode -description "Code trust for my code"';

If your code is split up to multiple assemblies you need every assembly to be signed with that strong name. You may need to set the SecurityPermission-Attribute with a link demand, that the security of the caller taken over.

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.ControlPrincipal)]
我不在是我 2024-07-18 00:27:04

在 .NET 3.5 之前,您需要完全信任共享才能从那里运行 .NET 应用程序。 Shawn 在此处对此进行了解释:“无需进行任何修改对于默认的 CAS 系统,我们处于加载包含安全对象的程序集和授予它们策略之间的永无休止的循环......进入 FullTrust 列表。”

在 .NET 3.5 中,通过“...默认授予 FullTrust 集,使它们的行为与直接从您的计算机启动一样”(来自 Shawn 的另一篇文章 此处

Prior to .NET 3.5, you need to fully trust the share to run a .NET application from there. Shawn explains this here with: "without some modification to the default CAS system, we're in a never ending cycle between loading assemblies that contain security objects and granting them policy. ... enter the FullTrust list."

In .NET 3.5 this limitation is overcome by "... granting set of FullTrust by default, making them act the same as if they were launched off of your computer directly" (from Shawn's another post here)

無處可尋 2024-07-18 00:27:04

授予强命名的程序集 FullTrust 权限听起来不错,但不幸的是,我的程序集引用了几个第三方 COM Dll,如果我对主程序集进行强命名,这些第三方 COM Dll 也需要进行强命名。 我猜测对 Shawn 给出的路径给予 FullTrust 是最好的解决方案:
CasPol.exe -pp off -m -ag 1.2 -url 文件://\ShawnFa-Srv/Tools/* FullTrust

Giving the strong named assmebly FullTrust permission sounds good, but unfortunately my assembly references several third-party COM Dlls which are also required to be strong-named if I strong-name the main assembly. I'm guessing then that giving FullTrust to the path as given by Shawn is the best solution:
CasPol.exe -pp off -m -ag 1.2 -url file://\ShawnFa-Srv/Tools/* FullTrust

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