I have a IIS hosted WCF service that is configured with a WebHttpBinding. It is the same default WCF service VS2008 creates when you create a new one. The only changes I have made is to allow it to be called from javascript.
In the test method GetData(int value), i return a string that displays the remote clients IP address, port, and useragent. Everything works fine, except I am not expecting the port number it is returning. I am expecting port 80, but instead get something like 49353. Below is the method I am calling.
public string GetData(int value)
{
OperationContext context = OperationContext.Current;
MessageProperties messageProperties = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpointProperty = messageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
return string.Format("Hello {0}! \r\naddress: {1}\r\nport: {2}\r\nuseragent: {3}",
value, endpointProperty.Address, endpointProperty.Port, WebOperationContext.Current.IncomingRequest.UserAgent);
}
Like I said, i am invoking this method from javascript. IIS is configured for port 80, so I am not sure why the port is being reported wrong.