In WCF 3.5 when we host the Service without a single Endpoint we get the exception saying we need to configure at least a single Endpoint. But in WCF 4.0 this is not the case because Service Runtime will automatically adds defaults endpoints for us.
When Service Host application calls Open method on the ServiceHost instance that time it creates Service description from the App.Config along with anything the host application may have configured explicitly and if the number of configured endpoints is still zero then it calls
AddDefaultEndpoints, a new public method found on ServiceHost class.
In the above code i have added a single service Endpoint with WSHttpBinding and also i invoked the method
AddDefaultEndpoints to add default endpoints as well. The
AddDefaultEndpoints method basically adds one default endpoint per base address for each service contract implemented by the service.
When I Enumerate the service endpoints i get the following list of endpoints. The Runtime added the default endpoints with basicHttpBinding
[Note: The above WCF Service application do not have any configuration file. To expose meta Data you can add App.config with following settings]