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?
Endpoints provide clients access to the functionality offered by a WCF service. Each endpoint consists of four properties: An address that indicates where the endpoint can be found. A binding that specifies how a client can communicate with the endpoint. A contract that identifies the operations available.
The service configuration has been modified to define two endpoints that support the ICalculator contract, but each at a different address using a different binding.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With