什么是应用程序域使用? [英] What are app domains used for?

查看:178
本文介绍了什么是应用程序域使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我大致明白一个AppDomain是什么,但我不完全了解一个AppDomain用途。

I understand roughly what an AppDomain is, however I don't fully understand the uses for an AppDomain.

我参与了大量基于服务器的C#/。 。C ++应用程序,我想知道如何使用的AppDomain可以提高稳定性/安全/性能

I'm involved in a large server based C# / C++ application and I'm wondering how using AppDomains could improve stability / security / performance.

在特定的:


  • 我明白,在一个域中的错误或致命异常不影响在同一个进程中运行的其他应用程序域 - 这是否也持有非托管真/ C ++异常,甚至可能是堆被损坏或其他内存问题

  • 如何跨AppDomain的沟通工作?

  • 如何使用从简单的产卵许多工艺不同的应用程序域?

推荐答案

基本用例一个AppDomain是托管第三方代码的环境中,所以这将是必要的不只是装载程序集动态的也卸载它们

The basic use case for an AppDomain is in an environment that is hosting 3rd party code, so it will be necessary not just to load assemblies dynamically but also unload them.

有没有办法单独卸载的组件。所以,你必须创建一个单独的AppDomain容纳任何可能需要被卸载。然后可以垃圾和必要时重建整个应用程序域

There is no way to unload an assembly individually. So you have to create a separate AppDomain to house anything that might need to be unloaded. You can then trash and rebuild the whole AppDomain when necessary.

顺便说一下,本机代码损坏堆不能针对由CLR的任何特征的保护。最终,CLR是本地实现的,共享相同的地址空间。所以在这个过程中本地代码可以涂抹遍CLR的内部!准备旁路顽劣的唯一方法(即多数)的本机代码是在操作系统级的实际进程隔离。启动多发的.exe程序,让他们通过某种IPC机制进行通信。

By the way, native code corrupting the heap cannot be protected against by any feature of the CLR. Ultimately the CLR is implemented natively and shares the same address space. So native code in the process can scribble all over the internals of the CLR! The only way to isolate badly behaved (i.e. most) native code is actual process isolation at the OS level. Launch mutiple .exe processes and have them communicate via some IPC mechanism.

这篇关于什么是应用程序域使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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