Asp. NET Programmer application Domain Information

Source: Internet
Author: User
Tags manual error code execution backup
Asp.net| Program | Programmer This article will discuss. NET application domains, and how they affect the execution and scheduling of ASP.net.

When you start the Notepad program in Windows, it is well known that the program executes a process that is contained within the container. You can start multiple instances of Notepad, and each instance will run in a dedicated process. Using Task Manager, you can see a list of all the processes currently running in the system.

A process includes code and program data that can be kept in memory from the operating system. There is only a few threads within the process that are executing instructions within the process, and in most cases there are multiple threads. If the program opens any files or resources, these resources will fall into this process.

A process also has a dividing line. An error code that is contained within a process cannot corrupt in a region other than the current process. It is easy to communicate within a process, but professional technology requires that one process communicate with another process is required. Each process is also running in a special context-safe system that prescribes what the process does in machines and networks.

A process is the smallest unit that runs independently in the Windows operating system. This raises a question for ISPs on a single server for a large stack of applications. The ISP will detach every asp.net application that interferes with another company's application on the same server. But the associated launch and execution of a process for hundreds of thousands of applications is prohibitive.

Introducing Application Domains

. NET describes the concept of an application domain, or appdomain like a process, AppDomain is both a container and a boundary line. NET run time uses AppDomain as a container for code and data, just as a procedure in the operating system acts as a container for code and data. When the operating system uses a process to detach the ragged code. NET runtime uses a AppDomain to separate code within a secure sideline.

A AppDomain only belongs to a single process, but a single process can maintain multiple AppDomain. A AppDomain is relatively easy to create (compared to a process) and has less maintenance costs compared to a process. For these reasons, a AppDomain is a good solution for ISPs (which provide thousands of applications). Each application can survive within an independent AppDomain, and many of these AppDomain can survive a single process (cost savings).

AppDomain

Two asp.net applications were created on the same server with no special configuration. What's going to happen?

A single asp.net manual process makes the ASP.net application a two-way primary program. In Windows XP and Windows 2000, this program is named aspnet_wp.exe, and this program runs in the front and back security relationships of the local ASPNET counter. The Windows 2003 manual program owns W3wp.exe and runs in the Networ service by default.

One can live in a AppDomain. Each asp.net application will have its own set of global variables: Cache,application into the same process,. NET AppDomain is a separate unit. If there are shared or static members of classes, and those classes exist within both applications, each AppDomain has its own backup of static fields-the data is not shared. The data and code of each application exist independently and within one boundary provided by the AppDomain.

To communicate between AppDomain or swap objects between AppDomain, you need to view the. NET through the boundaries of communication technology, such as. NET subtle or Web service.

One of the caveats to the idea of AppDomain as a boundary is that the ASP.net application runs with full trust by default. Fully trusted code can execute local code, and local code can essentially be anything within the process. You need to run a partial-trust execution application to constrain access to incomplete code and validate all code for secure AppDomain.

Hide Backup and reboot

Once a set is loaded into a AppDomain, there is no way to assemble from the AppDomain. However, it is possible to remove a appdomain from a process.

If you copy an updated DLL to a subdirectory of an application, you know from the ASP.net runtime that there is new code to execute. Since asp.net cannot copy a DLL to an existing AppDomain, it will start a new AppDomain. The old application domain is "drained", and that is, the existence needs to be allowed to execute and AppDomain can be unloaded once they have been completed. A new AppDomain with new code starts and starts all the new requests.

Typically, when a DLL is loaded into a process, the process locks the DLL and cannot overwrite the file on the disk. However, AppDomain has a well-known feature: The hidden copy that all of the unlocked replaceable sets that are allowed to remain on the disk.

The runtime initializes the asp.net with shadow copy of the binary subdirectory. AppDomain copies any lock DLLs from the binary subdirectory to a temporary location and loads the DLLs into memory. Shadow copy allows any DLL in the binary subdirectory to be overridden without the Web page being online.

Good command of Domain

The application domain replaces the OS process with a separate. NET node unit. An understandable application domain will give you the concept of a manual occurrence after the asp.net application. Using the CurrentDomain property of the AppDomain class, you can examine the properties of the AppDomain that the code is running, including the shadow Copy we discussed in this article.



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.