Getting server IP address in WCF?

How can I get the server address that was used to query when it has multiple IP addresses?

eg.

  • the server has addresses 10.0.0.1 and 10.0.0.2.
  • when processing the request, the server service must know if the client was 10.0.0.1 or 10.0.0.2 to connect to it.

So far, I have found that

  • OperationContext.Current.EndpointDispatcher.EndpointAddressand OperationContext.Current.Channel.LocalAddresscontain the address from .config (e.g. localhost)

  • OperationContext.Current.IncomingMessageProperties.Via contains the URL that the client used to connect to the server (but it may just be the name from the client hosts file).

EDIT: still looking for a solution ...

+3
source share
1 answer

, .

URL- - , , . " ", , .

, Message Inspector, , IP- , .

Google Bing "WCF Message Inspectors", - :

0

Source: https://habr.com/ru/post/1736116/


All Articles