放置在 GAC 中的程序集是否获得充分信任?

发布于 2024-07-06 20:32:00 字数 36 浏览 6 评论 0原文

我一直听到关于这个话题的相互矛盾的事实。 什么是正确的?

I've been hearing conflicting facts about this topic. What is correct?

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

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

发布评论

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

评论(2

画骨成沙 2024-07-13 20:32:00

您已经听到了相互矛盾的观点,因为这是一个非常令人困惑的话题,即使对于高级工程师也是如此。 简而言之,只需将程序集放入 GAC 中就隐含地给予其完全信任,但这可以通过安全策略覆盖。

EDIT1:让我补充一下,一个常见的想法是,如果您不完全信任某个程序集,为什么要将其放入 GAC 中?

编辑2:我在这里有一个来自 Michelle Bustamante 的博客文章的链接,但正如您在下面的评论中看到的,它不再可用,所以我从这个答案中删除了它。

You've been hearing conflicting views because it's a topic of great confusion, even among senior engineers. In short, simply placing an assembly in the GAC does implicitly give it full trust, but this can be overriden via security policy.

EDIT1: Let me add that a common thought is if you don't trust an assembly fully, why are you placing it in the GAC?

EDIT2: I had a link in here to a blog post from Michelle Bustamante, but as you can see in the comment below, it's no longer available so I removed it from this answer.

蓝梦月影 2024-07-13 20:32:00

我将尝试举一个可能有助于澄清问题的例子。 假设您有一个运行中等信任度的 Web 应用程序。 它需要做一些需要完全信任的事情,因此您创建一个类库项目(程序集)来完成该任务并将其安装到 GAC。 在测试中,新程序集可以完美地执行其功能,但是当您尝试在 Web 应用程序中使用它时,您会发现您仍然只有中等信任度。

I'll try to give an example that may help clear things up. Let's say you have a web app that runs medium trust. It needs to do something that requires full trust, so you create a class library project (assembly) to do that task and install it to the GAC. In testing, the new assembly performs it's function flawlessly, but when you try to use it in your web app, you discover that you still only have medium trust.

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