我有一个系统可以发送电子邮件,并在数量增加时对它们进行排队。
如果每小时发送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上的设置。 有人能指出我正确的方向吗?
答案 0 :(得分:0)
经过一些更多的谷歌搜索 - 它似乎是AWS'端的节流
来源: http://aws.amazon.com/ec2/faqs/
问:从EC2实例发送电子邮件有任何限制吗?
是。为了保持用于发送电子邮件的EC2地址的质量,我们对可以从EC2帐户发送的电子邮件数量实施默认限制。如果您希望从EC2发送大量电子邮件,您可以通过填写此表单申请从您的帐户中删除这些限制。
更好的细节: