.NET 信任级别问题

发布于 2024-09-15 04:47:50 字数 82 浏览 0 评论 0原文

是否可以对项目进行更改,从而导致其程序集在不同的信任级别中执行?如果是的话,那是什么?

据我了解,这只能在项目本身之外确定......

Is it possible to make a change to a project that will cause it's assembly to be executed in a different trust level? If so what is it?

From what I understand this can only be determined form outside of the project itself...

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

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

发布评论

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

评论(1

分開簡單 2024-09-22 04:47:50

我认为直接通过项目设置不可能做到这一点。但您可以尝试利用项目中的应用程序域。这意味着您必须更改程序的代码,所以我不确定您是否同意。

借助 appdomains ,您可以为每个程序集创建小沙箱,并在沙箱内运行程序集。对于每个应用程序域,您可以使用 AppDomain.CreateDomain 中的参数更改其权限集-方法。这是 David DeWinter“如何托管部分信任沙箱”。

您还可以使用 .NET Framework 配置工具来调整程序集的信任级别或 caspol 以给予其完全信任。但这些是在您的项目之外控制的。

I don't think this is possible directly through the project's settings. But you could try to leverage the application domains in your project. This means that you have to change your program's code so I'm not sure if that's OK with you.

With the help of appdomains, you can create little sandboxes for each of your assemblies and run the assemblies inside their sandboxes. For every appdomain, you can change their permission sets by using the parameters in AppDomain.CreateDomain-method. Here's a good tutorial by David DeWinter on "How to Host a Partial Trust Sandbox".

Also you can use the .NET Framework Configuration tool to adjust the assembly's trust level or the caspol to give it the full trust. But these are controlled outside your project.

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