页面超时发送电子邮件,即使邮件被发送 [英] Page times out sending emails, even though emails are sent

查看:276
本文介绍了页面超时发送电子邮件,即使邮件被发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题给我留下难倒。这个问题可能需要迁移到服务器故障,但有一个编程组件,所以我想我会从那里开始。此外,我们的基础架构团队热切地相信一切都在他们的结局很好,但是这并不意味着什么。

This issue has left me stumped. This question may need to be migrated to Server Fault, but there is a programming component, so I figured I'd start there. Also, our infrastructure team ardently believes everything is fine on their end, but that doesn't always mean anything.

不管怎么说,我有一个简单的GET-POST-重定向发送使用邮政的NuGet包两个独立的电子邮件,重定向到成功页面之前采取行动 - 非常基本的东西。行动是异步,而我使用等待email.SendAsync()从邮政API。

Anyways, I've got a simple GET-POST-Redirect action that sends two separate emails using the Postal nuget package, before redirecting to a success page -- pretty basic stuff. The action is async, and I'm using await email.SendAsync() from the Postal API.

当提交表单时,第一封电子邮件进入我的收件箱瞬间,但代码上挂起等待email.SendAsync()行有一个良好的15-20秒运动之前到下一行(在调试确认)。然后,它会在移动与重定向前行发送该行第二个电子邮件,这再次进入我的收件箱瞬间又一次的代码挂起,无论成功发送的,15-20秒。在生产中,这种延迟发送电子邮件,并结合了两封电子邮件后,使复位可以发送重定向响应前的连接。当然,我可以在页面超时,但并没有真正解决问题的用户仍然得到响应前一分钟长的延迟结束。

When the form is submitted, the first email comes into my inbox instantaneously, but the code hangs on that await email.SendAsync() line for a good 15-20 seconds before it moves on to the next line (confirmed in debugger). Then, it gets to sending the second email, which again comes into my inbox instantaneously and again the code hangs on that line, regardless of the successful send, for 15-20 seconds before moving on to the line with the redirect. In production, this delay after sending the email, combined for the two emails, causes the connection to reset before the redirect response can be sent. Sure, I could just up the page timeout, but that doesn't really fix the problem as the user still ends up with a minute long delay before getting a response.

我也试着只用 email.Send(),但出现相同的行为同步发送电子邮件。我已经通过了源邮政观看,虽然它周围SMTPClient一些自定义的包装材料,以发送异步电子邮件,有几乎没有什么比标准的旧的C#电子邮件同步发送方法。

I've also tried sending the emails synchronously with just email.Send(), but the same behavior occurs. I've looked through the source for Postal, and although it does some custom wrappings around SMTPClient to send asynchronous email, there's virtually nothing other than standard old C# email sending with the synchronous Send method.

它也不会绑定到该网站运行过程中,我可以看到在生产相同的行为在服务器和本地调试时(包括连接到同一生产Exchange服务器上,虽然)。

It's also not bound to the server where the site is running, as I can see the same behavior in both production and when debugging locally (both connecting to the same production Exchange server, though).

它的作用就像它等待的Exchange服务器发送某种已完成的反应,但是从我了解的SMTP,这是行不通的那样。它应该只是发送电子邮件到SMTP服务器,并继续快乐地一起,相信SMTP服务器实际上会做它应该做的。

It's acting like it's waiting for the Exchange server to send some sort of "finished" response, but from what I know about SMTP, it doesn't work like that. It should just send the email to the SMTP server and continue merrily along, trusting that the SMTP server will actually do what it's supposed to do.

任何想法,将不胜感激,因为我什至不知道如何继续在这一点上调试此。我还能测试或尝试一下呢?

Any ideas would be greatly appreciated, because I'm not even sure how to continue debugging this at this point. What else could I test or try?

更新

感谢@ MichaelEvanchik的建议尝试Wireshark的,我能清楚地看到,实际上还有所造成的Exchange服务器有30秒的延迟。它接收要发送的电子邮件的最后一位,然后30秒后终于响应客户端与成功排队等待传递。这是一个在这一点上,客户端终于退出和代码恢复。所以,我踢回给基础设施。

Thanks to @MichaelEvanchik's suggestion to try out Wireshark, I was able to clearly see that there's actually a 30 second delay caused by the Exchange server. It receives the last bit of the email to be sent and then 30 seconds later finally responds to the client with "Successfully queued for delivery". It's at this point that the client finally QUITs and the code resumes. So, I'm kicking it back to infrastructure.

更新#2

因此,显然有实际上是一个30秒的延迟把连接器上,以便该电子邮件已经真正被发送,不只是排队等待发货确认。就个人而言,我认为那种失败的摆在首位排队等待传递,但无论如何,我并不需要确认它的真正的发送,只是它是由接收点Exchange服务器上,所以基础设施移除的延迟。

So, apparently there was actually a 30 second delay put on the connector to allow for confirmation that the email had truly been sent and not just queued for delivery. Personally, I think that kind of defeats the point of "queued for delivery" in the first place, but regardless, I don't need confirmation that it's actually been sent, just that it was received by the Exchange server, so infrastructure is removing the delay.

推荐答案

Wireshark的可能摆脱一些线索。 =]

Wireshark might shed some clues. =]

这就是如何继续调试,并会告诉你,从http服务器继续到SMTP一切。

That is how to continue to debug, and will show you everything that is going on from http server to SMTP.

这篇关于页面超时发送电子邮件,即使邮件被发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆