最新消息:20210917 已从crifan.com换到crifan.org

【未解决】HttpWebRequest的GetResponse出错:无法连接到远程服务器,ErrorCode是10060

Web crifan 4652浏览 0评论

用C#代码模拟登陆Skydrive,访问URL:

https://c.live.com/c.gif?DI=15346&wlxid=cb3c03c3-d273-4d10-a008-f9fdd8b05343&reqid=002d97bd594&csiperf=ANON%3DDE389D4D076BF47BCAE4DC05FFFFFFFF%26NL%3D274%26TP%3D0%26CL%3DBL2xxxxxxC518%26MA%3Den-US%26B%3D16.2.3029%26TR%3D0%252AL%252ASetView-Init%253ASDX.Skydrive%252AFiles.default.F.A%26PLT%3D3640%26IR%3D1%26EX%3D0%26PCT%3D131%26PCD%3D131%26L.h%3D1804%26L.bc%3D1871%26L.ac%3D2605%26L.sjs%3D3055%26L.ttg%3D3638%26C.req%3D752%26C.resp%3D55%26C.navType%3D0%26C.redirectCount%3D1&r=0.0003431195728763603

在准备好了http的request之后,执行:

resp = (HttpWebResponse)req.GetResponse();

出现错误:

用户代码未处理 System.Net.WebException
  Message=无法连接到远程服务器
  Source=System
  StackTrace:
       在 System.Net.HttpWebRequest.GetResponse()
       在 InsertSkydriveFiles.skydrive.beforeUploadFile()
       在 InsertSkydriveFiles.skydrive.getSkydrivePrimeresponse(String username, String password)
       在 InsertSkydriveFiles.frmInsertSkydriveFile.btnLogin_Click(Object sender, EventArgs e)
       在 System.Windows.Forms.Control.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.PerformClick()
       在 System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
       在 System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
       在 System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
       在 System.Windows.Forms.Control.PreProcessMessage(Message& msg)
       在 System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
       在 System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
  InnerException: System.Net.Sockets.SocketException
       Message=由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 64.4.21.39:443
       Source=System
       ErrorCode=10060
       NativeErrorCode=10060
       StackTrace:
            在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
            在 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
            在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
       InnerException:

【解决过程】

1.之前这段代码是可以正确执行的,刚才是移动了前面几个网页访问次序。

现在再去移动回去,看看是否能解决。

转载请注明:在路上 » 【未解决】HttpWebRequest的GetResponse出错:无法连接到远程服务器,ErrorCode是10060

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
98 queries in 0.196 seconds, using 23.37MB memory