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?
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/MortgageService”;
ServiceHost serviceHost= new ServiceHost(typeof(MortgageService), new Uri[] { });
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();