Even though defining endpoints programmatically is possible, the most common approach
today is to use a configuration file associated with the service. Endpoint definitions embedded in code are difficult to change when a service is deployed, yet some endpoint characteristics, such as the address, are very likely to differ in different deployments. Defining endpoints in config files makes them easier to change, since changes don?t require modifying and recompiling the source code for the service class.
Thanks an Regards