WebClient.DownloadString takes about 15 seconds when first called

和自甴很熟 提交于 2019-12-01 18:43:25

There may be a couple of things that would cause a delay on the first call such as detecting proxy settings. Try setting the proxy to null:

client.Proxy = null;

Your machine is configured to perform Automatic Proxy Detection.

You can disable it here:

Alternatively, you can manually override the proxy to be used by the WebClient; null means no proxy:

client.Proxy = null;

However, you should offer the user to configure a proxy in your application in this case, because some users have to use a proxy when accessing the Web.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!