Вопрос

Using the HttpWebRequest (even when calling the async get method), it can take up to 15 seconds due to DNS resolution:

A Domain Name System (DNS) query may take up to 15 seconds to return or time out.

Is it possible to make this query in advance, so that it wont spend time at it when making the request?

Это было полезно?

Решение

It is very likely that the DNS resolution in HttpWebRequest is not pluggable. But you can do the resolution yourself and rewrite the URLs to use the resolved IP as the host name. Make sure to set the correct host-header, though, because many websites require it. Also, I believe HTTPS will be harder because certificate validation is based in part on the host name.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top