WCF 返回 IPv6 地址的不同部分
我正在使用下面的代码来获取 WCF 中客户端的 IP 地址
OperationContext context = OperationContext.Current;
MessageProperties messageProperties = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpointProperty =
messageProperties[RemoteEndpointMessageProperty.Name]
as RemoteEndpointMessageProperty;
return endpointProperty.Address;
如果我在客户端上运行 ipconfig,我会得到:
Windows IP Configuration
Ethernet adapter Local Area Connection 3:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::3864:610a:3dc:5acd%18
IPv4 Address. . . . . . . . . . . : 192.168.1.249
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.250
我的问题是,在某些调用中,我收到来自我的客户端的 IP 地址。代码 fe80::3864:610a
,因此我收到的其他调用 fe80::3864:610a:3dc:
这是正确的行为吗?我可以或者应该过滤这个吗?
I'm using the code below to get the IP address for the client in my WCF
OperationContext context = OperationContext.Current;
MessageProperties messageProperties = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpointProperty =
messageProperties[RemoteEndpointMessageProperty.Name]
as RemoteEndpointMessageProperty;
return endpointProperty.Address;
If I run a ipconfig
on my client, I get:
Windows IP Configuration
Ethernet adapter Local Area Connection 3:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::3864:610a:3dc:5acd%18
IPv4 Address. . . . . . . . . . . : 192.168.1.249
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.250
My problem is that, on some calls, I receive from my code fe80::3864:610a
, and so other calls I get fe80::3864:610a:3dc:
Is this a correct behavior? Can, or should, I filter this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论