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 … End
Interface Public Class CustomerService Implements ICustomerService … End Class 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.
Dim serviceAddress1 As Uri = New Uri(“http://contoso.com:8080/CustomerService/V1”)
Dim serviceAddress2 As Uri = New Uri(“http://contoso.com:8080/CustomerService/V2”) Dim
host As ServiceHost = New Service Host(GetType(ICustomerService), New Uri()
{serviceAddress1, serviceAddress2})

B.
Dim serviceAddress1 As Uri = New Uri(“http://contoso.com:8080/CustomerService/V1”)
Dim serviceAddress2 As Uri = New Uri(“http://contoso.com:8080/CustomerService/V2”) Dim
host As ServiceHost = New ServiceHost(GetType(CustomerService), New Uri()
{serviceAddress1, serviceAddress2})

C.
Dim serviceAddress As Uri = New Uri(“http://contoso.com:8080/”) Dim host As
ServiceHost = New Servic eHost(GetType(CustomerService), New Uri() {serviceAddress})
host.AddServiceEndpoint(GetType(ICustomer Service), New BasicHttpBinding(),
“CustomerService/V1”) host.AddServiceEndp oint(GetType(ICustomerService), New

BasicHttpBinding(), “CustomerService/V2”)

D.
Dim serviceAddress As Uri = New Uri(“http://contoso.com:8080/”) Dim host As
ServiceHost = New Service Host(GetType(ICustomerService), New Uri() {serviceAddress})
host.AddServiceEndpoint(GetType(CustomerService), New BasicHttpBinding(),
“CustomerService/V1”) host.AddServiceEnd point(GetType(CustomerService), New
BasicHttpBinding(), “CustomerService/V2”)


Leave a Reply