Eventually, I found the following to work:
{
String fullPath = HtmlPage.Document.DocumentUri.ToString();
int index = fullPath.LastIndexOf('/');
Uri uri = new Uri(fullPath.Substring(0, index + 1) +
serviceName);
return uri;
}
Service2Client CreateService2Client()
Service2Client CreateService2Client()
{
return new Service2Client(new BasicHttpBinding(),
new EndpointAddress(GetServiceUri("Service2.svc")));
}