Thus, in general, your interaction depends on several factors: your hose environment, code, and the settings of your website or application.
According to MSDN ( http://msdn.microsoft.com/en-us/library/ms733749.aspx ): There are two ways to specify the endpoint addresses for a service in WCF. You can specify the absolute address for each endpoint associated with the service, or you can specify the base address of the ServiceHost service, and then specify the address for each endpoint associated with this service that is defined with respect to this base address. You can use each of these procedures to specify the endpoint addresses for the service in configuration or code. If you do not provide a relative address, the service uses the base address.
You should also pay attention to your placement environment. For example, IIS itself generates your base address for the endpoint (even if it is specified in config), meanwhile, read it from the configuration on separate hosts.
The link above describes in great detail the features of determining your address in code or configuration and its dependence on the host environment
Alex
source share