我在制作电子邮件递送系统时遇到此异常,任何机构都可以解释这个......
{System.Net.Mail.SmtpException: 邮件发送失败。 ---> System.Net.WebException:无法执行 连接到远程服务器---> System.Net.Sockets.SocketException:没有 可以联系,因为 目标机器积极拒绝它 在 System.Net.Sockets.Socket.DoConnect(端点 endPointSnapshot,SocketAddress socketAddress)at System.Net.Sockets.Socket.InternalConnect(端点 remoteEP)at System.Net.ServicePoint.ConnectSocketInternal(布尔 connectFailure,Socket s4,Socket s6, 插座及放大器; socket,IPAddress&地址, ConnectSocketState状态,IAsyncResult asyncResult,Int32超时,异常& 例外)---内心的结束 异常堆栈跟踪--- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream,Object owner,Boolean async,IPAddress&地址,插座& abortSocket,Socket& abortSocket6, Int32超时)at System.Net.PooledStream.Activate(对象 owningObject,Boolean async,Int32 超时,GeneralAsyncDelegate asyncCallback)at System.Net.PooledStream.Activate(对象 owningObject,GeneralAsyncDelegate asyncCallback)at System.Net.ConnectionPool.GetConnection(对象 owningObject,GeneralAsyncDelegate asyncCallback,Int32 creationTimeout) 在 System.Net.Mail.SmtpConnection.GetConnection(字符串 主机,Int32端口)at System.Net.Mail.SmtpTransport.GetConnection(字符串 主机,Int32端口)at System.Net.Mail.SmtpClient.GetConnection() 在 System.Net.Mail.SmtpClient.Send(MAILMESSAGE 消息)---内部异常结束 堆栈跟踪--- at System.Net.Mail.SmtpClient.Send(MAILMESSAGE 消息) Email.mailWrapper.Send(String strTo, String strFrom,String strSubject, 字符串strBody)在C:\ Documents和 设置\ asd \ My Documents \ Visual 工作室 2005 \项目\ PlacementManager \电子邮件\ mailWrapper.cs:行 158}
答案 0 :(得分:1)
这只是说,您配置了System.Net.Mail.SmtpClient
的任何端口都被防火墙阻止在服务器上,否则它甚至都不会监听该端口。