Introduction to ASP. NET programmer application domains

Source: Internet
Author: User
Tags in domain

This article discusses. NET application domains and how they affect ASP. NET execution and scheduling.
  
When the Notepad program is started in Windows, it is well known that the program will execute a process contained in the container. You can start multiple notepad instances, and each instance will run in a dedicated route. Use the task manager to view the list of all processes currently running in the system.
  
A process includes code and program data that can be executed in the memory retained from the operating system. Within a process, there is only one thread that contains instructions being executed within the process, and in most cases there are multiple threads. If the program opens any files or resources, these resources belong to this process.
  
A process also has a line. The error code contained in the process cannot corrupt outside the current process. Communication is easy within one process, but professional technology requires one process to communicate with another process. Each process also runs in a special context Security System, which specifies what processes are doing on machines and networks.
  
 
A process is
The minimum unit for independent operation in the operating system. This raises a question to the ISP of a large number of applications on a single server. The ISP will separate every one on the same server from another company
ASP. NET applications that applications interfere. However, the process cost of launching and executing a program for hundreds of thousands of applications is not allowed.
  
  Introduction to application domains
  
 
. NET introduces the concept of an application domain, or appdomain is like a process. appdomain is both a container and a boundary .. Net Running time usage
Appdomain is used as a container for code and data, just like an operating system process as a container for code and data. When the operating system uses a process to separate untidy code,. Net runs
An appdomain is used to separate the code within a security edge.
  
An appdomain only belongs to a single process, but can be maintained by a single process.
Multiple AppDomains. An appdomain is relatively easy to create (compared with a process) and has a low maintenance cost compared with a process. For these reasons
Appdomain is a good solution for ISP (providing thousands of applications. Each application can survive in an independent appdomain, and many of these
Appdomain can survive in a single process (cost saving.
  
  Appdomain
  
Two ASP. NET applications are created on the same server without any special configuration. What will happen?
  
 
A single ASP. NET manual process turns ASP. NET applications into two main applications. In Windows XP and Windows
In, the program was named as aspnet_wp.exe, and the program runs in the security relationship of the local ASPnet counter. In Windows
The 2003manual project has w3wp.exe and runs in networ service by default.
  
One pair of users can live in one
Appdomain. Each ASP. NET application puts a set of global variables: cache and application into the same process. net
Appdomain is an independent unit. If there are shared or static member classes that exist in two applications, each appdomain has its own static field
-Data is not shared. The data and code security of each application are independent and provided by appdomain within a single boundary.
  
In order to communicate between AppDomains or exchange objects between AppDomains, You need to view communication technologies that pass through boundaries in. net, such as. Net subtle or web services.
  
 
One warning of using appdomain as the boundary idea is that ASP. NET applications run with full trust by default. Fully trusted code can execute local code, and local
The code can be essentially any content within the process. You need to run an application with partial trust to constrain access to incomplete code and verify all code for secure appdomain.
  
  Hide backup and restart
  
Once a collection is loaded to an appdomain, there is no way to get from the appdomain set. However, it is possible to remove an appdomain from a process.
  
 
If you copy an updated DLL to a subdirectory of an application, you can see that new code is to be executed from the ASP. NET runtime. Since ASP. NET cannot copy DLL to an existing
In the appdomain, it starts a new appdomain. The old application domain is "drainage stopped", that is, existing applications must be allowed to complete the execution once they are completed.
Appdomain can be detached. The new appdomain with new code starts and starts all new requests.
  
Typically, when a DLL is loaded into a process, the process locks the DLL and cannot overwrite the files on the disk. However, appdomain has a well-known feature: Hiding copies of all unlockable replaceable sets that are allowed to be retained on the disk.
  
 
The running time has shadow on the binary subdirectory.
Copy ASP. NET initialization. Appdomain copies any DLL before locking from the binary subdirectory to a temporary location and then loads the DLL to the memory.
Shadow Copy allows you to overwrite any DLL in the binary subdirectory without putting the webpage online.
  
  Proficient in domain
  
 
The application domain replaces the OS process as a separate. NET node unit. An understandable application domain will give you a manual concept after ASP. NET applications. Use
The currentdomain attribute of the appdomain class. You can check the attributes of the appdomain in which the code is running, including the shadow discussed in this article.
Copy.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.