Building WCF service applications using method 1: Self-hosting administratively using an application configuration file
Having created an application configuration file, open an instance of the service and add the specified code to the application.
Before starting
Create or edit an application configuration file for the service, as described in: Create a WCF custom channel administratively by supplying binding and endpoint information in an application configuration file
About this task
- Instantiate and open an instance of the service in the service host. The service type must be the same as the service type specified in the service configuration file.
- Add the following code to the application:
ServiceHost service = new ServiceHost(typeof(MyService)); service.Open(); ... service.Close();Parent topic: Building and hosting services for WCF