WCF 发现失败,套接字在 XP 的上下文中无效?
我正在尝试在.NET 4.0 中使用 WCF 的发现机制。它可以在 Windows 7 上运行,但在 XP 计算机上失败,并出现套接字异常,提示“请求的地址在其上下文中无效”(端点为soap.udp://239.255.255.250:3702)。
Windows 7 与 XP 的对比是转移注意力吗? netstat 似乎没有显示任何冲突。我在这里缺少什么?
我创建了一个简化的测试服务,使用以下配置显示问题:
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata/>
<serviceDiscovery />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<endpointDiscovery />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="HelloWorldService">
<host>
<baseAddresses>
<add baseAddress="http://localhost/Demo"/>
</baseAddresses>
</host>
<endpoint kind="mexEndpoint" />
<endpoint kind="udpDiscoveryEndpoint" />
<endpoint contract="Test.IHelloWorld"
address="/Hello"
binding="basicHttpBinding" />
</service>
</services>
</system.serviceModel>
</configuration>
I'm trying to use WCF's discovery mechanism in .NET 4.0. It works on Windows 7 but fails on an XP machine with a socket exception saying that "the requested address is not valid in its context" (the endpoint is soap.udp://239.255.255.250:3702).
Is the Windows 7 vs XP a red herring? netstat doesn't seem to show any conflicts. What am I missing here?
I've created a simplified test service that shows the problem using the following config:
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata/>
<serviceDiscovery />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<endpointDiscovery />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="HelloWorldService">
<host>
<baseAddresses>
<add baseAddress="http://localhost/Demo"/>
</baseAddresses>
</host>
<endpoint kind="mexEndpoint" />
<endpoint kind="udpDiscoveryEndpoint" />
<endpoint contract="Test.IHelloWorld"
address="/Hello"
binding="basicHttpBinding" />
</service>
</services>
</system.serviceModel>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Microsoft Connect。不幸的是,目前没有解决方法,微软的回应是
There is an issue logged on Microsoft Connect. Unfortunately there is currently no workaround and Microsoft response is
XP 机器是否位于防火墙或路由器后面?具体来说,239.255.255.250这个地址真的属于XP机器,还是它实际上使用了NAT地址?尝试运行 ipconfig 看看它认为它有什么。
Is the XP machine behind a firewall or router? To be specific, does the address 239.255.255.250 really belong to the XP machine, or does it actually use a NAT address? Try running ipconfig to see what it thinks it has.