You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The creation, configuration and deployment of Remoting applications form part of your responsibilities at Domain.com.
You are currently developing a client application that will use Microsoft.NET Remoting to access functionality implemented by a remote component. This remote component is exposed through the HyperText Transfer Protocol (HTTP) channel. Furthermore the remote component will make use of the default formatter to serialize and deserialize data.
You now need to configure the client application in such a way so as to enable it to serialize data in a form that is expected by the remote component. You may not use custom channels and formatters.
What should you do? (Choose the correct configuration.)
A.
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref=”soap”>
<clientProviders>
<formatter ref=”http”/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
B.
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref=”http”>
<clientProviders>
<formatter ref=”binary”/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
C.
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref=”http”>
<clientProviders>
<formatter ref=”soap”/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
D.
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref=”binary”>
<clientProviders>
<formatter ref=”http”/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
Explanation:
The channel element’s ref attribute should be set to http, and the formatter element’s ref attribute to soap, because the channel element specifies the channel through which the application will communicate with the remote component. The only available channels are HTTP, IPC and TCP. The formatter element specifies the serialization formatter responsible for the serialization and deserialization of data that passes through the channel. The only available formatters are SOAP and Binary. The HTTP channel used the SOAP formatter whereas the TCP and IPC channels use the binary formatter by default.
Incorrect answers:
A: The channel element ref cannot be set to SOAP because SOAP is not a channel. If you do this then you will need to implement a custom HTTP channel and specify Soap as its name. However, it is stated in the question that you may not make use of custom channels or custom formatters.
B: You should not set the formatter ref attribute to binary because the default formatter for HTTP channel is SOAP and in this case the remote component makes use of the default formatter for HTTP.
D: The channel element ref cannot be set to binary since binary is not a channel. If you do this then you will need to implement a custom HTTP channel and you may not make use of a custom channel or formatter. Furthermore, HTTP is not a formatter and if you do this then again it will require a custom SOAP formatter.