2

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>
Russ
  • 393
  • 1
  • 7
  • 18

2 Answers2

1

There is an issue logged on Microsoft Connect. Unfortunately there is currently no workaround and Microsoft response is

The exception you are mentioning is normally hit when trying to bind the socket to an IP address that isn't valid. Can you please check this and if possible try on a machine with a different OS. There are currently no known limitations of the WCF Discovery feature on XP.

Sam B
  • 2,441
  • 2
  • 18
  • 20
  • This looks uncomfortably like what I'm seeing. This is probably the answer, but I'll hold off marking this as such, hoping for a happier ending! – Russ Jan 22 '11 at 21:10
  • @Russ: I hope you will get a solution to this... My feeling is there is a problem and MS will need to issue an HotFix. I suggest you to post on Microsoft Connect so at least another person will report the problem. Good luck :) – Sam B Jan 22 '11 at 21:14
  • Not really an answer per se, but as good a lead as I'm probably going to get. Thanks! – Russ Jan 22 '11 at 21:32
0

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.

Chris Wenham
  • 23,679
  • 13
  • 59
  • 69
  • The XP machine is behind a router. The machine's IP address (from ipconfig) is 192.168.1.104. Not sure where you're going with this, but I'll try most anything! I thought the 239.255.255.250 address was the well-known multi-cast addr for service discovery? – Russ Jan 22 '11 at 21:09
  • I'm not sure myself, actually, but it was a hunch. Although I don't think my answer is a real solution, if I had the same problem this would be my first lead. – Chris Wenham Jan 22 '11 at 21:15