用好AppDomain中的例子 [英] Good example of use of AppDomain

查看:267
本文介绍了用好AppDomain中的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在问有关的AppDomain在接受采访时,和我知道的基本知识

I keep getting asked about AppDomains in interviews, and I know the basics:

  • 在他们的应用程序中的隔离级别(使它们从不同的应用程序)
  • 在他们可以有螺纹(使它们从不同的线程)
  • 在一个AppDomain中的异常不影响另一个
  • 的AppDomain无法访问彼此的记忆
  • 在每个应用程序域可以有不同的安全

我还是不明白是什么让他们有必要的。我在寻找一个合理的具体情况时,你会使用一个。

I still don't get what makes them necessary. I'm looking for a reasonable concrete circumstance when you would use one.

回答:

  • 不可信code
    • 保护
      核心应用 不可信/第三方插件从堕落共享内存和非授权访问注册表或硬盘驱动器与安全限制单独的AppDomain禁止通过隔离,保护应用程序或服务器。例如ASP.NET和SQL服务器托管组件code
    • Untrusted code
      • Core application protected
        Untrusted/3rd party plugins are barred from corrupting shared memory and non-authorized access to registry or hard drive by isolation in separate appdomain with security restrictions, protecting the application or server. e.g. ASP.NET and SQL Server hosting component code

      • 稳定性 应用程序分割成安全,独立的特性/功能
      • 在结构上的灵活性
        自由单CLR实例或在自己的每一个程序中运行多个应用程序。
      • Stability
        Application segmented into safe, independent features/functionality
      • Architectural flexibility
        Freedom to run multiple applications within a single CLR instance or each program in its own.

      还有别的吗?

      推荐答案

      也许最常见的是加载包含插件code,从不受信任的第三方组件。在code运行在自己的AppDomain,隔离应用程序。

      Probably the most common one is to load assemblies that contain plug-in code from untrusted parties. The code runs in its own AppDomain, isolating the application.

      此外,这是不可能卸载特定组件,但可以卸载的AppDomain。

      Also, it's not possible to unload a particular assembly, but you can unload AppDomains.

      有关完整的破败,克里斯Brumme对这个巨大的博客文章:

      For the full rundown, Chris Brumme had a massive blog entry on this:

      <一个href="http://blogs.msdn.com/cbrumme/archive/2003/06/01/51466.aspx">http://blogs.msdn.com/cbrumme/archive/2003/06/01/51466.aspx

      这篇关于用好AppDomain中的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆