9-Host-Client-(How to host a
WCF service in a Windows service)-Part 6
Duration: 20 minutes
Summary: In this video, we continue our discussion of hosting WCF services. Specifically, we will see how to host a WCF service in a Windows service. To do that, we add a new Windows Service project to the existing solution. We create an instance of the ServiceHost, and call the Open() and Close() methods within the Start() and Stop() methods respectively. Using a windows service is very convenient to start and stop the host. We add the app.config file to have the base address and endpoints. Then, we add an installer for the service and run the InstallUtil utility to install the service. That way, we can see the service running in the services applet. We start the Windows service (which starts the WCF service). Now, we can make calls to the service and be able to retrieve the metadata information.
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, Windows Service, Installer, ServiceUtil.