Miscellaneous Concepts of .NET – Part 1
page 5 of 9
by Uday Denduluri
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 43331/ 118

Managed Portion of CLR Hosts

Now, the unmanaged portion of CLR host has loaded the CLR into the process. A default domain is created automatically by the CLR after it is loaded into the process. This default domain will be unloaded only after the process shuts down.  This is the reason that most hosts do not run user code in the default domain as it cannot be shut down independently of the process. The ICorRuntimeHost is the interface that exposes some methods for creating application domains and unloading the same. Let us discuss some of the important methods of ICorRuntimeHost in detail. This will help us to understand ICorRunimeHost in a better manner.


Method Name



Creates an application domain. Gets an interface pointer of type System._AppDomain. Takes a friendly name of the Application domain.


Creates an application domain. This method extends the functionality of the CreateDomain method by allowing the caller to pass the instance of IAppDomainSetup. IAppDomainSetup provides properties that allow the host to configure an AppDomain before calling ICorRuntimeHost::CreateDomainEx to create it. It has properties like ApplicationBase, Application Name, LicenseFile, etc.


Starts the common language runtime.


Unloads the common language runtime from the current process.


Unloads the application domain represented by pAppDomain from the current process. Takes the reference of the application domain as the parameter.


Returns an enumerator for the domains in the current process.


Returns an interface pointer to the AppDomain running on the current thread.


Returns an interface pointer to the next domain in the enumeration. Takes the EnumDomains as the parameter.


Returns an interface pointer of type _AppDomain, representing the default domain for the current process.

ICLRRunTimeHost is the interface developed for the CLR version 2.0. This interface is the superseded interface of ICorRuntimeHost. This interface has a new method called as SetHostControl. SetHostControl must be called before the common language runtime is initialized, that is, before a call to the Start method. It is always recommended to call SetHostControl immediately after a call to CorBindToRuntimeEx [Unmanaged API].

View Entire Article

User Comments

Title: Good One   
Name: Shilpa Ginode
Date: 2008-05-06 2:52:19 AM
Good article on Application Domain.
i learned this concept from this article.
Title: Good   
Name: pankaj
Date: 2007-07-18 8:00:21 AM
Title: Thanks   
Name: Leonzhu
Date: 2007-05-07 10:31:56 AM
Thanks for your excellant article
Title: Good Article on Application Doamin   
Name: Bhavannarayana.aluri
Date: 2007-04-30 1:11:05 AM
Nice article on Application domain
Title: Excellant   
Name: Joydip
Date: 2007-04-26 3:17:22 AM
This is an outstanding article Uday. Keep it up. I would like to see more articles of this kind from you.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-12-02 7:57:15 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search