A Windows Communication Foundation (WCF) service implements the following contract.
[ServiceContract| public interface IHelloService { [OperationContract]
[VVebGet(UriTemplate = “hello?namee{name}”)] string SayHello(string name); } The
implementation is as follows. public class HelloService: IHelloService { public string
SayHello(string name) { return “Hello “.+ name; } } The senvice is self-hosted, and the
hosting code is as follows. WebServiceHost svcHost = CreateHoseO; svcHost.OpenO;
Console. ReadLineO; SrvHost.CloseO; You need to implement CreateHost so that the
senvice has a single endpoint hosted at http://localhost:8000/HelloService which code
segment should you use?
A.
WebServiceHost svcHost new WebServiceHost(typeof(HelloService));
svcHost.AddServiceEndpoint(typeof(lHelloService), new
WebHttpBinding(WebHttpSecurityMode None), “http://localhost:8000/HelloService”); return
svcHost;
B.
Ur baseAddress new Uri(’http //Iocalhost 8000/”); WebServiceHost svc Host = new
WebServiceHost(new HelloService0, baseAddress), svc
Host.AddServiceEndpoint(typeof(IHelloService), new WebHttpBinding(WebHttpSec
urityMode None), “HelloService”); retumn svc Host;
C.
Ur baseAddress = new Urit’http:I/localhost:800O1″);r WebServiceHost svc Host new
WebServiceHost(typeof(HelloService), baseAddress);
svcHostAddServiceEndpoint(typeof(lHelloService), new
WebHttpBinding(WebHttpSecurityMode. None), “HelloService”); return svc Host;
D.
WebServiceHost svcHost = new Web Service Host(new HelloServiceO); svcHost
AddServiceEndpoint(typeof(lHelloService), new WebHttpBinding(WebHttpSecurityMode.
None), “http://Iocalhost: 8000/HelloService”); return svcHost