0
그래서 특정 지점에서 웹 페이지를로드하는 C#에서 HtmlAgilityPack 프로그램을 만들고 있습니다. 많은 페이지를로드 한 후, 내가이 오류 : 라인 37 나는 forloop 내부 페이지를로드하고있어에서전송 연결에서 데이터를 읽을 수 없습니다. C# HtmlAgilityPack
Unhandled Exception: System.IO.IOException: Unable to read data from the transpo
rt connection: An existing connection was forcibly closed by the remote host. --
-> System.Net.Sockets.SocketException: An existing connection was forcibly close
d by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size,
SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 s
ize)
--- End of inner exception stack trace ---
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadToEnd()
at HtmlAgilityPack.HtmlDocument.Load(TextReader reader) in d:\Source\htmlagil
itypack.new\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 612
at HtmlAgilityPack.HtmlWeb.Get(Uri uri, String method, String path, HtmlDocum
ent doc, IWebProxy proxy, ICredentials creds) in d:\Source\htmlagilitypack.new\T
runk\HtmlAgilityPack\HtmlWeb.cs:line 1422
at HtmlAgilityPack.HtmlWeb.LoadUrl(Uri uri, String method, WebProxy proxy, Ne
tworkCredential creds) in d:\Source\htmlagilitypack.new\Trunk\HtmlAgilityPack\Ht
mlWeb.cs:line 1479
at HtmlAgilityPack.HtmlWeb.Load(String url, String method) in d:\Source\htmla
gilitypack.new\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1103
at HtmlAgilityPack.HtmlWeb.Load(String url) in d:\Source\htmlagilitypack.new\
Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1061
at ConsoleApplication1.Program.Main(String[] args) in
c:\Users\...ConsoleApplication1\Program.c
s:line 37
: 나는 오류에 대한 몇 가지 연구를 위해 노력했다
for (var i = 0; i< 5000; i++)
var page = web.Load(url+Convert.ToString(i+1)+"/");
, 그러나 밖에서 형성에 많은 것이 없었다.
이것은 Html Agility Pack 라이브러리와는 아무 관련이 없습니다. 오류는 HTTP/TCP/소켓 레이어에서 발생합니다. 단지 서버에 문제가 있거나 전화를 거절하는 것입니다. –
그래, 고마워,하지만 어떻게이 오류를 해결할 수 있습니까? – breght
많은 일들이 원인 일 수 있습니다. 서버를 소유하지 않으면 실제로 알 수 없습니다. 그들은 당신을 예를 들어 해커로 감지 할 수 있습니다. –