欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

The underlying connection was closed错误

程序员文章站 2022-12-01 18:15:38
今天理IIS上Asp.net程序的所有报错日志,发现好报The underlying connection was closed: Unable to connect to the...
今天理IIS上Asp.net程序的所有报错日志,发现好报The underlying connection was closed: Unable to connect to the remote server. 于是搜了下,发现很多人遇到这个异常,可是却没有标准的解决方案,一般有一下几种。

 

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

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

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

4.重装.Net Framework。

5.如果用了抓取,可以将HttpWebRequest的KeepAlive属性设置为false,HttpWebRequest的KeepAlive属性默认是true

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