【发布时间】:2014-04-03 03:41:56
【问题描述】:
我有一个系统,可以在邮件量增加时发送电子邮件并将它们排队。
如果是每小时 1 或 2 封电子邮件,它可以发送出去。
在繁忙的时候,队列会被备份,很快电子邮件发送就会开始失败。
我已经从本地对 SMTP 服务器进行了负载测试 - 那里没有问题。
但是,当我尝试从我的 EC2 服务器进行负载测试时
- 在 VPC 的私有子网中
- 传出流量通过 NAT
- 我们在哪里设置了自己的 DNS 服务器
前几个正常 - 其余的开始抛出错误。
这是 C# 异常 ToString()
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebExcept
ion: Unable to connect to the remote server ---> System.Net.Sockets.SocketExcept
ion: A connection attempt failed because the connected party did not properly re
spond after a period of time, or established connection failed because connected
host has failed to respond [SMTPServerIP]:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object ow
ner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket
6)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Gener
alAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate
asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncD
elegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at ConsoleApplication2.Program.Main(String[] args) in c:\ConsoleApplication2\
Program.cs:line 49
我很确定这不是代码问题 - 很可能是 NAS 或 DNS 上的设置。 有人能指出我正确的方向吗?
【问题讨论】:
标签: amazon-web-services dns smtp nat vpc