PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing a Windows Communication Foundation (WCF) service that contains the
following code segment. [ServiceContract ] public interface ICustomerService { & } public
class CustomerService : ICustomerService { & } The service is self-hosted in a console

application. Older client applications access the service at
http://contoso.com:8080/CustomerService/V1. Newer client applications access the service
at http://contoso.com:8080/CustomerService/V2. You need to ensure that any client
application can access the service at either address. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Uri serviceAddress1 = new Uri(“http://contoso.com:8080/CustomerService/V1”); Uri
serviceAddress2 = new Uri(“http://contoso.com:8080/CustomerService/V2”); ServiceHost
host = new ServiceHost(typeof(ICustomerService), new Uri[] { serviceAddress1,
serviceAddress2 });

B.
Uri serviceAddress1 = new Uri(“http://contoso.com:8080/CustomerService/V1”); Uri
serviceAddress2 = new Uri(“http://contoso.com:8080/CustomerService/V2”); ServiceHost
host = new ServiceHost(typeof(CustomerService), new Uri[] { serviceAddress1,
serviceAddress2 });

C.
Uri serviceAddress = new Uri(“http://contoso.com:8080/”); ServiceHost host = new
ServiceHost(typeof(CustomerService), new Uri[] { serviceAddress });
host.AddServiceEndpoint(typeof(ICustomerService), new BasicHttpBinding(),
“CustomerService/V1”); host.AddServiceEndpoint(typeof(ICustomerService), new
BasicHttpBinding(), “CustomerService/V2”);

D.
Uri serviceAddress = new Uri(“http://contoso.com:8080/”); ServiceHost host = new
ServiceHost(typeof(ICustomerService), new Uri[] { serviceAddress });
host.AddServiceEndpoint(typeof(CustomerService), new BasicHttpBinding(),
“CustomerService/V1”); host.AddServiceEndpoint(typeof(CustomerService), new
BasicHttpBinding(), “CustomerService/V2”);


Leave a Reply