PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
The application consumes a Microsoft Windows Communication Foundation (WCF) service.

The WCF service exposes the following method.

[WebInvoke]
string UpdateCustomerDetails(string custID);

The application hosts the WCF service by using the following code segment.
WebServiceHost host = new WebServiceHost(typeof(CService), new Uri(“http://win/”));
ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService), new WebHttpBinding(), “”);

You need to invoke the UpdateCustomerDetails method.

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri(“http://win”));
ICService channel = wcf.CreateChannel();
string s = channel.UpdateCustomerDetails(“CustID12”);

B.
WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri(“http://win/UpdateCustomerDetails”));
ICService channel = wcf.CreateChannel();
string s = channel.UpdateCustomerDetails(“CustID12”);

C.
ChannelFactory<ICService> cf = new ChannelFactory<ICService>(new WebHttpBinding(), “http: //win/UpdateCustomerDetails”);
ICService channel = cf.CreateChannel();
string s = channel.UpdateCustomerDetails(“CustID12”);

D.
ChannelFactory<ICService> cf = new ChannelFactory<ICService>(new BasicHttpBinding(), “http: //win”)
cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
ICService channel = cf.CreateChannel();
string s = channel.UpdateCustomerDetails(“CustID12”);


Leave a Reply