php请求出现解决"The underlying connection was closed: A connection that was expected to be kept alive w...

分析网址:https://euipo.europa.eu/eSearch/#advanced/designs/1/100/n1=ApplicationDate&v1=01%2F07%2F2018%20-%2030%2F06%2F2019&o1=AND&n2=ApplicantCountry&v2=CN&o2=AND&sf=DesignIdentifier&so=asc

最近在处理一个数据请求的时候,提示:The underlying connection was closed: A connection that was expected to be kept alive was closed。

php请求出现解决
请求错误提示

发现很多人也遇到这个异常,可是却没有标准的解决方案,百度了很多信息,经过测试成功了,现在把方法贴出来,供大家参考。

1.如果用了代理,设置正确。

2.如果用了firewall,将firewall禁掉试试。

3.将Lan设置中的Automatically Detect Settings禁掉。

4.重装.Net Framework。

5.如果用了抓取,可以将HttpWebRequest的KeepAlive属性设置为false,HttpWebRequest的KeepAlive属性默认是true。在请求头中补上KeepAlive:false

php请求出现解决

对应我线上的程序,1、2、3、4都可以排除,我的就是抓取时报这个错,采用了第5种方法后,异常消失了。

投稿人:八维数据

你可能感兴趣的:(php请求出现解决"The underlying connection was closed: A connection that was expected to be kept alive w...)