Definition - What does Application Domain mean?
An application domain is a logical isolation boundary created around .NET applications so that applications do not access or affect each other. It is a light-weight process having its own set of code, data, and configuration settings. Application domains are created by the runtime hosts, which are invoked by the common language runtime (CLR) to load the applications that need to be executed.
Prior to .NET, the isolation boundary between applications was the processes in which they were loaded. Every process had its own private virtual memory and can not access the memory of another process directly. Application domain has features similar to that of a process.
Application domains have the following features:
- Optimum utilization of system resources by using fewer processes to execute multiple applications.
- Reliability by using isolation of tasks in situations where data cannot be shared and for unstable tasks that need to be unloaded without affecting the process.
- Better efficiency by executing long-running processes that rarely use large extensions with optimal memory.
- Application security by restricting the direct access to the code running in one application from the code or resources of another application.
- Security control by specifying configuration details along for each application domain.
Techopedia explains Application Domain
Application domain differs in the manner in which the CLR loads and executes multiple .NET applications in one single process. It does not allow direct access to the memory of loaded applications. It is managed by the CLR of the .NET Framework whereas a process is managed by the OS. The CLR provides fault isolation between application domains with less overhead than processes, due to its inherent feature of verifiable type-safety of managed code. Also, multiple threads can reside in an application domain, they are free to cross application domain boundaries.
For example, ASP.NET is a runtime host that creates multiple application domains for each user accessing a web site. They can also be created and configured for applications that need to isolate code or to load extensions only while using them. This fact makes application domains useful in situations where plug-ins and other untrusted code is used. They are also useful in minimizing the working set of applications that use large DLLs.
To enable communication between objects in different application domains one of the following three types of objects is used:
- Marshal-By-Value: Complete copy of the object passed to the calling application domain. This is used when the state of object can be moved for performance reasons.
- Marshal-By-Reference-Reference (MBR): A proxy of the object is passed to the client; used when the state of the object has to stay within the application domain.
- Context-bound: MBR object used across domains or within the context of its own application domain.