Best way to get the endpoint address programmatically is to create the Service Client by creating the endpoint. Pass the current url to the endpoint constructor:
<br />
new Uri(Application.Current.Host.Source, "../MyService.svc");<br />
Provided "MyService.svc" is present in the root directory of your web application.
Please vote for it if it helps you.