7-Host-Client-(Configuring properly with base address and endpoints)-Part 4
Duration: 16 minutes
Summary: Now that the service is configured properly with base address and endpoints, we spend our time in the main method. We add the appropriate ‘using’ statements, and we instantiate a ServiceHost. The ServiceHost instance is based on the name of the endpoint we are interested in using. Then, we add our try-catch block. We call Open() to open the service and make it ready for client calls. In the catch block we call the Abort() method to terminate the service in case an exception occurs. After the service is done responding to client calls, we call the Close() method. Finally we add a methods that prints detailed information about the endpoints and some of their properties.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: Windows Communication Foundation
Keywords: Windows Communication Foundation (WCF), ServiceContract, DataContract, Endpoint, Address, Binding, Contract, Service, Interface, class, Host, Client, Config.