IPv4 remote address in WCF

后端 未结 5 1163
忘了有多久
忘了有多久 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:06

    You're seeing ::1 because you're connecting to the service by resolving the name "localhost" instead of addressing it as "127.0.0.1". Modern versions of Windows that have the IPv6 stack enabled will use IPv6 first.

    You can disable the IPv6 stack, but that's roughly the same as making like an ostrich and sticking your head in the sand. IPv6 is here, and people are using it on their networks, so your application should be prepared to support it.

提交回复
热议问题