Register IP address in WCF service

I use NLog in my WCF service and want to register the caller's IP address.

I tried using aspnet-LayoutRenderers ( ${aspnet-request:serverVariable=remote_host} , ${aspnet-request:serverVariable=remote_addr} ), but to no avail since an internal NLog exception is thrown and no log file is generated.

Is there a way to register an IP address in a WCF service without having to pass it as a parameter to the called method?

+4
source share
1 answer
 var msg = OperationContext.Current .IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; var address = msg.Address; 
+6
source

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


All Articles