70-513 · Question #118
A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract| public interface IHelloService { [OperationContract] [VVebGet(UriTemplate =…
The correct answer is A. WebServiceHost svcHost new WebServiceHost(typeof(HelloService)). See the full explanation below for the reasoning.
Question
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
Options
- AWebServiceHost svcHost new WebServiceHost(typeof(HelloService));
- BUr baseAddress = new Urit'http:I/localhost:800O1");
- CWebServiceHost svcHost = new Web Service Host(new HelloServiceO);
- DUr baseAddress new Uri('http //Iocalhost 8000/");
How the community answered
(31 responses)- A84% (26)
- B3% (1)
- C10% (3)
- D3% (1)
Community Discussion
No community discussion yet for this question.