日期:2014-05-18  浏览次数:23515 次

由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 219.142.78.189:58 ?????
哪里出错了,求解
  
 SmtpClient smtp = new SmtpClient();
  smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
  smtp.EnableSsl = false;
  smtp.Host = "smtp.sina.cn";
  smtp.Port =587;
  smtp.UseDefaultCredentials = false;

  smtp.Credentials = new NetworkCredential("dana156825961@sian.cn", "************");
   
  MailMessage email = new MailMessage();

  email.From = new MailAddress("dana156825961@sian.cn", "weijain", System.Text.Encoding.GetEncoding(936));
  email.To.Add("156825961@qq.com");

  email.Subject = "add new account";
  email.Body = "you have a new account";
  email.IsBodyHtml = false;
  email.Priority = MailPriority.High;
  smtp.Send(email);
  lblMessage.Text = "User added successfully";
  txtAddUser.Text = "";
由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 219.142.78.189:58 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Net.Sockets.SocketException: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 219.142.78.189:58

源错误: 


行 112: email.IsBodyHtml = false;
行 113: email.Priority = MailPriority.High;
行 114: smtp.Send(email);
行 115: lblMessage.Text = "User added successfully";
行 116: txtAddUser.Text = "";
 

源文件: F:\SkySharp\SkySharp\SkySharp\SkySharp\ManageUsers.aspx.cs 行: 114 

堆栈跟踪: 


[SocketException (0x274c): 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 219.142.78.189:58]
  System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
  System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
  System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: 无法连接到远程服务器]
  System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5501831
  System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
  System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
  System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
  System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
  System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
  System.Net.Mail.SmtpClient.GetConnection() +35
  System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: 发送邮件失败。]
  System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
  SkySharp.ManagerDatabases.btnAddSubmit_Click(Object sender, EventArgs e) in F:\SkySharp\SkySharp\SkySharp\SkySharp\ManageUsers.aspx.cs:114
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
  Syst