I am trying to find the URL that the client used to access the server (server side). I tried the following:
Uri url = OperationContext.Current.Channel.RemoteAddress.Uri; Uri url = OperationContext.Current.Channel.Local.Uri; Uri url = OperationContext.Current.EndpointDispatcher.EndpointAddress.Uri;
but none of them worked correctly. They all return the server name (with a fully qualified domain, for example myserver.mydomain.local. Even if I used myserver / myservice.svc, it would get the full name.
At this moment, I do not have the service and domain available for testing at mywebsite.com/myservice.svc to find out if it has a machine name or not.
The result I want to get (from the server will be):
http://mywebsite.com/myservice.svc
but not
http: //myserver.mydomain.local/myservice.svc
what seems to be happening at the moment.
source share