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

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

Description

CreateDomain

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

CreateDomainEx

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.

Start

Starts the common language runtime.

Stop

Unloads the common language runtime from the current process.

UnloadDomain

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

EnumDomains

Returns an enumerator for the domains in the current process.

CurrentDomain

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

NextDomain

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

GetDefaultDomain

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
Comment:
Good article on Application Domain.
i learned this concept from this article.
Title: Good   
Name: pankaj
Date: 2007-07-18 8:00:21 AM
Comment:
good
Title: Thanks   
Name: Leonzhu
Date: 2007-05-07 10:31:56 AM
Comment:
Thanks for your excellant article
Title: Good Article on Application Doamin   
Name: Bhavannarayana.aluri
Date: 2007-04-30 1:11:05 AM
Comment:
Nice article on Application domain
Title: Excellant   
Name: Joydip
Date: 2007-04-26 3:17:22 AM
Comment:
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-2019 ASPAlliance.com  |  Page Processed at 2019-08-21 6:36:39 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search