【问题标题】:Is there a way to switch from Fulltrust to PartialTrust at Runtime? (WPF)有没有办法在运行时从 Fulltrust 切换到 PartialTrust? (WPF)
【发布时间】:2010-01-02 07:11:22
【问题描述】:

我不希望我的 WPF 应用程序在 Fulltrust 中运行,但不可能在部分信任的 AppDomain 中运行 WPF(我什至尝试使用 WPF 托管/互操作)并且 WPF 浏览器应用程序不符合我的需求,所以我的问题是:

在 WPF 创建 Window 并进行所有初始化非托管调用后,有没有办法在运行时更改当前 AppDomain 的 SecurityZone?

谢谢你:)

【问题讨论】:

    标签: c# wpf security appdomain


    【解决方案1】:

    这是不可能的,因为一旦您在 FullTrust 中运行,您就会被“污染”,并且运行时不可能保证 Partial Trust。但是,根据您的方案,您可以创建另一个 AppDomain 以在其中运行不受信任的代码,并将对象编组到完整/部分域,或者您可以将您的应用程序编写为具有更严格限制的 SL4 Out-of-Browser 应用程序。

    【讨论】:

      猜你喜欢
      • 2011-12-26
      • 2013-06-10
      • 1970-01-01
      • 2021-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多