PrepAway - Latest Free Exam Questions & Answers

Which code fragment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
The service will be hosted in a managed Console application.
You want to add endpoints to the service.
You need to ensure that all endpoints use the same base address.
Which code fragment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
[ServiceContract]
public interface IMortgageService {}
public class MortgageService : IMortgageService {}
Uri baseAddress=new Uri("http://localhost:8888/Mortgageservice");
serviceHost serviceHost= new serviceHost(typeOf(Mortgageservice), new Uri[] {baseAddress});
serviceHost.AddServiceEndpoint(typeOf(IMortgageservice), new basicHttpBinding(), "" );
serviceHost.Open();

B.
[ServiceContract]
public interface IMortgageService {}
public class MortgageService : IMortgageService {}
Uri baseAddress=new Uri("http://localhost:8888/Mortgageservice");
serviceHost serviceHost= new serviceHost(typeOf(Mortgageservice), new Uri[]{});
serviceHost.AddServiceEndpoint(typeOf(IMortgageservice), new basicHttpBinding(), baseAddress);
serviceHost.Open();

C.
[ServiceContract]
public interface IMortgageService {}
public class MortgageService : IMortgageService {}
string baseAddress="http://localhost:8888/MongageService";
serviceHost serviceHost= new serviceHost(typeOf(Mortgageservice), new Uri[] {"http://www.cenmagic.com"});
serviceHost.AddServiceEndpoint(typeOf(IMortgageservice), new basicHttpBinding(), baseAddress);
serviceHost.Open();

D.
[ServiceContract(Namespace="http://localhost:8888/Mortgageservice")]
public interface IMortgageService {}
public class MortgageService : IMortgageService {}
serviceHost serviceHost = new serviceHost(typeOf(Mortgageservice), new Uri[] {});
serviceHost.AddServiceEndpoint(typeOf(IMortgageservice), new basicHttpBinding(), "" );
serviceHost.Open();


Leave a Reply