首页 新闻 搜索 专区 学院

使用HttpWebRequest 和HttpWebResponse读取网页时候出错

0
悬赏园豆:20 [待解决问题]

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 202.*.*.36:80

我在公司的测试服务器(有独立IP)上是可以成功抓取网页数据的  但是发布之后 报上面错误

哪位高手知道为何么?

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(adminUrl);
            request.Method = "GET";
            
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream streamReceive = response.GetResponseStream();

            StreamReader streamReader = new StreamReader(streamReceive, System.Text.Encoding.Default);
            string strResult = streamReader.ReadToEnd();

wesleyliu的主页 wesleyliu | 初学一级 | 园豆:110
提问于:2011-09-15 20:51
< >
分享
所有回答(2)
0

检查一下服务器上开放的端口跟防火墙

artwl | 园豆:16536 (专家六级) | 2011-09-15 21:06
0

在服务器上通过命令行运行 telnet 202.*.*.36 80,看是否能正常连接。

dudu | 园豆:37751 (高人七级) | 2011-09-15 21:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册