Wednesday, May 26, 2010

What’s AppDomain (Application Domain):

When 10 users browse a page say (login.aspx) in a published website, ASP.Net Worker Process (w3wp.exe) creates 10 application domains to host the page assembly into it for each client, thus creates 10 appDomains.

appDomain

assembly

App_Web_Login.aspx.fdf7a39c.dll


So, what’s the story?

When run any application, the operating system hosts it in a process (p1) to be ran by the processor . and if the run another different application(OS hosts it into another process (p2)).if app1 wants to access an assembly (dll or exe) form app2, the accessing will be managed by OS which is slow.

The another solution:-

Host the assemblies you want into an application domain (which is a logical boundary you create to host many assemblies as you wish). the appDomain is managed by .net framework but process is managed by the operating system (which is slower)

Operating system:

Process1

appDomain1

assembly

App_Web_Login.aspx.fdf7a39c.dll

assembly

DataAccessLayer.dll 

appDomain2

assembly

App_Web_EmployeeData.aspx.fdf7a39c.dll 

End of the story;

C# fast-food by:
Eng.Waleed abou-zaid
Senior Software Developer
Harf Information Technology
MCSD.Net,MCAD.Net,MCP,A+,N+ certified
walid.abouzaid@gmail.com



4 comments:

Anonymous said...

Agreed with your explaination, I even understood the importance of having AppDomain. But can you give me some real time example of using AppDomain. Or few condition where using AppDomain makes sense?

Anonymous said...

AssalamoAlykum Waleed,

Can we use AppDomains in two entirely separate ASP.NET applications. I have a requirement where the user can swith between 2 applications using a link on both ASP.NET applications (with 2 separate DBs). Now I want to share the Log-In credentials so the user doesn't have to type in the user id password again when switching. Can we load assembly or something or use AppDomain to achieve this goal?

Thanks in advance.

WHQ

Anonymous said...

Super cool catching description. Thank you

Anonymous said...

good