What should you do?

You have been asked by you superiors at Domain.com to create a child application domain.
The new child application domain has to specify a different assembly path than that of the parent application domain.
You need to ensure that your solution meets Domain.com’s requirements.
What should you do?

You have been asked by you superiors at Domain.com to create a child application domain.
The new child application domain has to specify a different assembly path than that of the parent application domain.
You need to ensure that your solution meets Domain.com’s requirements.
What should you do?

A.
Use the following code:
AppDomainSetup domainSetup = new AppDomainSetup ();
domainSetup.ApplicationName = @”C:Program FilesChildApp”;
AppDomain.CreateDomain (“ChildDomain”, AppDomain.CurrentDomain.Evidence, domainSetup);

B.
Use the following code:
AppDomainSetup domainSetup = new AppDomainSetup ();
domainSetup.ApplicationBase = @”C:Program FilesChildApp”;
AppDomain.CreateDomain (“ChildDomain”, AppDomain.CurrentDomain.Evidence, domainSetup);

C.
Use the following code:
AppDomainSetup domainSetup = new AppDomainSetup ();
domainSetup.ConfigurationFile = @”C:Program FilesChildApp”;
AppDomain.CreateDomain (“ChildDomain”, AppDomain.CurrentDomain.Evidence, domainSetup);

D.
Use the following code:
AppDomainSetup domainSetup = new AppDomainSetup ();
domainSetup.CachePath = @”C:Program FilesChildApp”;
AppDomain.CreateDomain (“ChildDomain”, AppDomain.CurrentDomain.Evidence, domainSetup);

Explanation:
The CreateDomain method of the AppDomain class is an overloaded method that you can use to create an application domain. This code creates a child application domain named ChildDomain,
which uses the same evidence as its parent domain and specifies an AppDomainSetup object. In this version of CreateDomain, the first argument passed to the CreateDomain method is a String that represents
the name of the application domain to be created.
The second argument of the CreateDomain method specifies an Evidence object. The Evidence object represents the identity information used for Code Access Security (CAS) in the
Microsoft .NET Framework to determine the permissions granted to an assembly. The third argument of the CreateDomain method specifies an AppDomainSetup object. The AppDomainSetup object represents application domain settings such as the application name, base directory, and configuration file path. You have to specify a different assembly path than that of the parent application domain,
so the ApplicationBase property of the AppDomain object has to be set. The ApplicationBase property defines the base directory of an application. Any runtime references will be resolved using this directory for assembly probing.
Incorrect Answers:
A: You should not use the code that sets the ApplicationName property of the AppDomainSetup object
because this should be the friendly name of the application domain.
C: You should not use the code that sets the ConfigurationFile property of the AppDomainSetup object
because this should be the directory where the configuration file is located.
D: You should not use the code that sets the CachePath property of the AppDomainSetup object
appDomainSetup.ApplicationBase = @”C:Program FilesChildApp”;
ApplicationBase:
Ruft den Namen des Verzeichnisses ab, das die Anwendung enth�lt, oder legt diesen fest. Ein String, der den Namen des Basisverzeichnisses der Anwendung enth�lt. Das Anwendungsbasisverzeichnis ist das Verzeichnis, in dem der Assembly-Manager zuerst nach Assemblys sucht



Leave a Reply 1

Your email address will not be published. Required fields are marked *


mr_tienvu

mr_tienvu

I agree with the answer. B