user34537
user34537

Reputation:

Force ipv4 connections in .NET?

I am running a console app on my server and trying to connect to my site also on the server. Its causing problems by connecting via ipv6. The software i am running in php doesnt support ipv6 thus i get errors. How do i force the console app (which is using webclient) to use ipv4 connection/ip address rather then ipv6?

Upvotes: 2

Views: 3376

Answers (1)

Joel Coehoorn
Joel Coehoorn

Reputation: 415881

This depends entirely on how the underlying operating system and network resolves the name. If your dns returns an IPv6 address, that's what it will use. There's nothing in .Net that can change that, unless you want to write your own dns lookup code to ignore ip6 responses.

Upvotes: 1

Related Questions