How to get cleint ip address in wcf rest service ( webinvoke) RRS feed

  • Question

  • Hi 

    i want to get client ipaddress using below sample.


     i have operationcontract method as "webInvoke" , it is giving ipaddress of the wcf host but not the actual client ipaddress. 

    here is my service contract . Inside GetIBookResults() method i a mtrying to get client ip address. using (

    public IList<Employee> GetIBookResults(string EValues)

    OperationContext context = OperationContext.Current;
                    MessageProperties messageProperties = context.IncomingMessageProperties;
                    RemoteEndpointMessageProperty endpointProperty =
                        as RemoteEndpointMessageProperty;

                    string clientIpAddress = endpointProperty.Address;)



    here is my service contract



        public interface IIBookService

            [WebInvoke(Method = "GET",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.Bare,
                UriTemplate = "employees/EValues={EValues}")]
            IList<Employee> GetIBookResults(string EValues);


    Please help me on this.

    Thursday, March 8, 2012 9:00 PM