Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 569
Banshee Avatar asked Jul 05 '13 11:07

Banshee


People also ask

Where we define endpoints in WCF?

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.

How many endpoints can a WCF Service have?

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.


1 Answers

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

like image 185
Josh Avatar answered Sep 25 '22 08:09

Josh