PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 06?

You are upgrading an ASMX Web service to a Windows Communication Foundation service application by using .NET Framework 3.5.
You plan to support existing legacy client applications.
You write the following service contract.
[ServiceContract]
interface IPicturesServer
{
[OperationContract]
byte[] GetImage(int id);
}
class PicturesServer: IPicturesServer
{
public byte[] GetImage(int id)
{
return new byte[] { 1, 2, 3 };
}
}
You host the service by using the following code segment. (Line numbers are included for reference only.)
01 using (ServiceHost host=new
02 ServiceHost(typeof(PicturesServer)))
03 ?{
04 BindingElement transport=new
05 HttpTransportBindingElement();
06
07 CustomBinding binding=new CustomBinding(encoding,
08 transport);
09 host.AddServiceEndpoint(typeof(IPicturesServer), binding,
10 address);
11 host.Open();
12 Console.WriteLine("Listening");
13 Console.ReadLine();
14 }
You need to transfer binary data from the server to the client applications.
Which code segment should you insert at line 06?

PrepAway - Latest Free Exam Questions & Answers

A.
BindingElement encoding = new BindingElement()

B.
BindingElement encoding = new MtomMessageEncodingBindingElement(…..)

C.
BindingElement encoding = new TextMessageEncodingBindingElement(MessageVersion.Soap11…..)

D.
BindingElement encoding = new TextMessageEncodingBindingElement(Soap12WSAddressingAugust2004..)


Leave a Reply