应用程序域(Application Domain)

时间:2014-09-28 22:08:06   收藏:0   阅读:326

应用程序域为隔离正在运行的应用程序提供了一种灵活而安全的方法。

应用程序域通常由运行时宿主创建和操作。 有时,您可能希望应用程序以编程方式与应用程序域交互,例如想在不停止应用程序运行的情况下卸载某个组件时。

应用程序域使应用程序以及应用程序的数据彼此分离,有助于提高安全性。 单个进程可以运行多个应用程序域,并具有在单独进程中所存在的隔离级别。 在单个进程中运行多个应用程序提高了服务器伸缩性。

下面的代码示例创建一个新的应用程序域,然后加载并执行以前生成的程序集 HelloWorld.exe,该程序集存储在驱动器 C 上。

// Create an Application Domain:
System.AppDomain newDomain = System.AppDomain.CreateDomain("NewApplicationDomain");

// Load and execute an assembly:
newDomain.ExecuteAssembly(@"c:\HelloWorld.exe");

// Unload the application domain:
System.AppDomain.Unload(newDomain);

应用程序域具有以下特点:

原文:http://www.cnblogs.com/chenyongblog/p/3999023.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!