DRAG DROP
Contract exhibit:
[ServiceContract]
public interface IHelloService
[OperationContract]
[WebGet(UriTemplate =“helloname={name}”)]
string PassGuideHello(string name);
}
Class exhibit:
public class HelloService: IHelloService
{
public string PassGuideHello(string name)
{ return “Hi there “ + name;
}
}
Hosting code exhibit:
WebServiceHost svcHost = CreateHost();
svcHost.Open();
Console.ReadLine();
SrvHost.Close();
There is a WCF (Windows Communication Foundation) service PassGuideService.
The contract of PassGuideService, the implementation, and self-hosted service hosting code are
displayed in separate exhibits.
A single endpoint, at http://PassGuide:7500/HelloService, is used for the implementation of CreateHost.
Which code should you use?
Explanation: