什么是.NET应用程序域? [英] What is a .NET application domain?

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

问题描述

在特定的,什么是在两个不同的应用程序域中运行code的含义是什么?

In particular, what are the implications of running code in two different application domains?

如何数据通常跨应用程序域边界传递?它是一样的跨进程边界传递数据?我很好奇,想知道更多关于这个抽象,它是很有用的。

How is data normally passed across the application domain boundary? Is it the same as passing data across the process boundary? I'm curious to know more about this abstraction and what it is useful for.

编辑:好现有一般的AppDomain类的覆盖率<一href="http://stackoverflow.com/questions/622516/i-dont-understand-appdomains">http://stackoverflow.com/questions/622516/i-dont-understand-appdomains

Good existing coverage of the AppDomain class in general at http://stackoverflow.com/questions/622516/i-dont-understand-appdomains

推荐答案

这是的AppDomain 基本上提供在$进程内C $ C同时运行一个孤立的区域。

An AppDomain basically provides an isolated region in which code runs inside of a process.

这是简单的方法来把它几乎就像一个轻量级的过程坐在你的主要流程的内部。过程中完全隔离,​​它允许您运行code安全(也可以不用,如果需要拆除的全过程卸载)中的每个应用程序域存在,单独的安全等。

An easy way to think of it is almost like a lighter-weight process sitting inside of your main process. Each AppDomain exists within a process in complete isolation, which allows you to run code safely (it can be unloaded without tearing down the whole process if needed), with separate security, etc.

至于你的具体情况 - 如果你运行code在2个不同的AppDomain的过程中,在code将单独运行。该应用程序域之间的任何通信将获得无论是序列化或通过MarshallByRefObject处理。它的行为非常喜欢在这方面使用远程处理。这提供了大量的安全性 - 你可以运行code,你不相信,如果做错了事,也不会影响到你。

As to your specifics - if you run code in 2 different AppDomains within a process, the code will run in isolation. Any communication between the AppDomains will get either serialized or handled via MarshallByRefObject. It behaves very much like using remoting in this regard. This provides a huge amount of security - you can run code that you don't trust, and if it does something wrong, it will not affect you.

有在MSDN的描述更多详情,请应用程序域

There are many more details in MSDN's description of Application Domains.

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

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