用C#代码模拟登陆Skydrive,访问URL:
在准备好了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