How to get a Fast .Net Http Request

后端 未结 3 1623
不知归路
不知归路 2021-02-03 11:26

I need an Http request that I can use in .Net which takes under 100 ms. I\'m able to achieve this in my browser so I really don\'t see why this is such a problem in code.

3条回答
  •  无人及你
    2021-02-03 12:03

    Try setting the Proxy property of the HttpWebRequest instance to null. If that works, then try setting it to GlobalProxySelection.GetEmptyWebProxy(), which seems to be more correct.

    You can read more about it here: - WebRequest slow?: http://holyhoehle.wordpress.com/2010/01/12/webrequest-slow/


    Update 2018: Pulling this up from the comments.

    System.Net.GlobalProxySelection is obsolete.This class has been deprecated. Please use WebRequest.DefaultWebProxy instead to access and set the global default proxy. Use null instead of GetEmptyWebProxy(). – jirarium Jul 22 '17 at 5:44

提交回复
热议问题