问题描述
您好,我有一个多线程邮件应用,偶尔会收到此错误。这是一个SmtpException。我以后重新发送电子邮件,从我能说的就可以了。我旁边的网络管理员告诉我,如果我尝试在一个连接中发送超过1000条消息,此Exchange将回复此消息。
每个线程(每个服务器有4个)在SmtpClient对象上创建它自己的实例,并且永远不会一次发送超过200条消息(例如,每个线程最多检索一批200条消息) 。我每秒发送大约10-200条消息,具体取决于一天中的时间。
我使用Reflector查看了System.Net.Mail程序集,看起来.NET框架在一些连接池下运行封面可能是原因的一部分,虽然我无法确定。
所以,考虑到所有这一切,有人可以指出一些可能需要注意的事项或者注意事项吗? SmtpClient对象没有明确的close方法,因此我可能会猜测并且当对象超出范围时,表示与smtp服务器的连接未被关闭。对此有所了解?
Hi there,
I have a multithreaded mail app that is getting this error occasionally. It's a SmtpException. I'm resending the email later and it goes through OK from what I can tell. The network admin beside me is telling me this Exchange will respond with this message if I try to send more than 1000 messages in one connection.
Each thread (of which there are 4 per server) is creating it's own instance on the SmtpClient object and is never sending more than 200 messages through this at once (e.g. each thread retrieves a batch of 200 messages maximum). I'm sending around 10-200 messages a second depending on time of day.
I've looked at the System.Net.Mail assemblies using Reflector and it looks like the .NET framework does some connection pooling under the covers which may be part of the cause although I can't tell for sure.
So, with all this in mind, can someone point out some possible things to watch out for or dos and don'ts around this? The SmtpClient object doesn't have a explicit close method so I could hazard a guess and say that the connection to the smtp server isn't being closed when the object goes out of scope. Throughts on this?
推荐答案
这篇关于服务不可用,关闭传输通道。服务器响应为:#4.x.2此会话的消息太多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!