IPv4 remote address in WCF

后端 未结 5 1164
忘了有多久
忘了有多久 2020-12-19 01:24

Related to How to get the IP address of a WCF remote endpoint?

I am using this code to retrieve the remote IP address when a workflow method is invoked:



        
5条回答
  •  爱一瞬间的悲伤
    2020-12-19 02:15

    The workaround proposed by Murat will not work. The MSDN says - if you pass the IP address to the GetHostAddresses method this address is returned in an array without querying the DNS. To get it working you will need to query for the host name first, using GetHostEntry method. And then, using the host name, use GetHostAddresses. However, even the GetHostEntry may have the list of addresses that will be enough for you.

提交回复
热议问题