开发者

Force ipv4 connections in .NET?

开发者 https://www.devze.com 2023-04-09 08:02 出处:网络
I am running a console app on my server开发者_如何学C 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

I am running a console app on my server开发者_如何学C 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消