[英]What is causing my ASP.NET MVC app to stop emailing and recycling the app pool to immediately fix it?
Every 30 to 60ish minutes, our app's email notifications (via System.Net.Mail.SmtpClient) stop sending.每 30 到 60 分钟,我们应用程序的电子邮件通知(通过 System.Net.Mail.SmtpClient)就会停止发送。 As soon as we recycle the app pool, the emails start flowing again.一旦我们回收应用程序池,电子邮件就会再次开始流动。 I have checked and double-checked the code and added additional USING statements to make certain all SmtpClient-related objects are being properly disposed after use.我已经检查并仔细检查了代码并添加了额外的 USING 语句,以确保所有与 SmtpClient 相关的对象在使用后都被正确处理。 If it were an SMTP issue I don't think recycling the app pool would fix it.如果是 SMTP 问题,我认为回收应用程序池不会解决它。 Has anyone else encountered this issue and figured out the root cause and fix?有没有其他人遇到过这个问题并找出根本原因并修复?
As far as I see from the previous experience with Quartz.NET
, the problem is most probably related to IIS
rather than the schedulers ie Quartz.NET
, Hangfire
, etc. You might try to install Keep Alive Service For IIS 6.0/7.5 on the server to which you publish your application.就我以前使用Quartz.NET
经验Quartz.NET
,问题很可能与IIS
相关,而不是与调度程序(即Quartz.NET
、 Hangfire
等)有关。您可以尝试在 IIS 6.0/7.5上安装Keep Alive Service For IIS您发布应用程序的服务器。 After that, your published application will be alive after application pool recycling, IIS/Application restarting, etc.之后,您发布的应用程序将在应用程序池回收、IIS/应用程序重新启动等之后处于活动状态。
Note: If you use IIS 7.5
and above you can use the last version of Keep Alive
as well.注意:如果您使用IIS 7.5
及更高版本,您也可以使用最新版本的Keep Alive
。 Hope this helps...希望这可以帮助...
Possible solution in this SO answer: Email sending service in c# doesn't recover after server timeout此 SO 答案中的可能解决方案: 服务器超时后,c# 中的电子邮件发送服务不会恢复
Bump maxconnections
in your web.config
凹凸maxconnections
在你web.config
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.