Get current endpoint on WCF Services?

Banshee picture Banshee · Jul 5, 2013 · Viewed 8k times · Source

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?

Answer

Josh picture Josh · Jul 5, 2013

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