Search code examples
c#.netwcfserver-sideendpoint

Get current endpoint on WCF Services?


I have a WCF service communicating with client over TCP. Is there anyway to gather information about the current connect in a service method? For example the endpoint that the current user is using?


Solution

  • You can use the OperationContext.Current property to get all kinds of useful information about the method you are currently in.

    For your specific example:

    OperationContext.Current.EndpointDispatcher.EndpointAddress