PrepAway - Latest Free Exam Questions & Answers

You need to resolve this exception

You create a .NET Remoting object named AdminService, which is hosted in Internet Information Services (IIS). The object uses an HttpChannel and a BinaryFormatter. AdminService is in an assembly named AdminService.dll. The URL for AdminService is http://LocalHost/AdminService/AS.rem.

You write a test console application named Tester.exe to test the AdminService interface. Tester.exe includes the following code segment:

public class Tester {
public static void Main(string[] Args) {
AdminService service = new AdminService();
// Code to exercise the service object.
}
}

You write a configuration file for Tester.exe. The configuration file is named Tester.exe.config and
includes the following code segment:
You run Tester.exe. The application immediately throws a System.NullReferenceException. The exception includes the following message: “Object reference not set to an instance of an object.” You need to resolve this exception.

What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
To the application element of the Tester.exe.config file, add the following code segment:
<channels>
<channel ref=”http”>
<clientProviders>
<formatter ref=”binary”/>
</clientProviders>
</channel>
</channels>

B.
Replace the use of the AdminService constructor in Tester.exe with the following code segment:
AdminService service =
(AdminService)Activator.CreateInstance(
typeof(AdminService));

C.
At the beginning of the Main method in Tester.exe, add the following line of code:
RemotingConfiguration.Configure(“Tester.exe.config”);

D.
Rename the configuration file from Tester.exe.config to Tester.config.


Leave a Reply