Russ
Russ

Reputation: 393

WCF with discovery fails with socket not valid in its context on XP?

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>

Upvotes: 2

Views: 690

Answers (2)

Chris Wenham
Chris Wenham

Reputation: 24017

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.

Upvotes: 0

Sam B
Sam B

Reputation: 2481

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.

Upvotes: 1

Related Questions