Questions tagged «system.net.webexception»

27
无法连接,因为目标计算机主动拒绝了吗?
有时在对WebService执行HttpWebRequest时收到以下错误。我也复制了下面的代码。 System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:80 在System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress) 在System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) 在System.Net.ServicePoint.ConnectSocketInternal处(布尔型connectFailure,Socket s4,Socket s6,Socket&套接字,IPAddress&地址,ConnectSocketState状态,IAsyncResult asyncResult,Int32超时,Exception&异常) ---内部异常堆栈跟踪的结尾--- 在System.Net.HttpWebRequest.GetRequestStream() ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.PreAuthenticate = true; request.Credentials = networkCredential(sla); request.Method = WebRequestMethods.Http.Post; request.ContentType = "application/x-www-form-urlencoded"; request.Timeout = v_Timeout * 1000; if (url.IndexOf("asmx") > 0 && parStartIndex > 0) { AppHelper.Logger.Append("#############" + …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.