0

我已将我的 WebAPI 站点上传到临时服务器,当应用程序尝试通过 MvcMailer 发送电子邮件时,我收到 SmtpException,但电子邮件确实按照正确收件人的要求发送!

非常奇怪的行为。当产生发送异常时,电子邮件肯定不应该发送吗?

它也是一个新的 Windows Server 2012 版本,这是第一个站点,所以它可能是我忘记做的其他事情。

任何人都有任何想法可能导致这种行为?

以下是配置设置:

<system.net>
<mailSettings>
  <smtp from="no-reply@mysite.com">
    <network host="127.0.0.1" port="25" />
  </smtp>
</mailSettings>
</system.net>

这是错误:

{"message":"发生错误。","exceptionMessage":"发送邮件失败。","exceptionType":"System.Net.Mail.SmtpException","stackTrace":" 在 System.Net.Mail。 SmtpClient.Send(MailMessage 消息)\r\n 在 Mvc.Mailer.SmtpClientWrapper.Send(MailMessage mailMessage)\r\n 在 Mvc.Mailer.MvcMailMessage.Send(ISmtpClient smtpClient)\r\n 在 Rpm.ReportBuilder.Web。 Controllers.EmailController.GetSendEmail(String template, Int32 id)\r\n 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassc.b__6(Object instance, Object[] methodParameters)\r\n 在 System. Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n 在 System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- 堆栈跟踪从上一个引发异常的位置结束 ---\r\n在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()\r\n 在 System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- 堆栈跟踪从上一个引发异常的位置结束 ---\r\n在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext ()\r\n--- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime 处从先前引发异常的位置结束堆栈跟踪。 CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n 在 System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1。MoveNext()","innerException":{"message":"发生错误。","exceptionMessage":"无法从传输连接读取数据:net_io_connectionclosed。","exceptionType":"System.IO.IOException ","stackTrace":" 在 System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)\r\n 在 System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)\r\n 在 System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n 在 System.Net.Mail。 SmtpClient.Send(MailMessage 消息)"}}发生错误。","exceptionMessage":"无法从传输连接读取数据:net_io_connectionclosed。","exceptionType":"System.IO.IOException","stackTrace":" at System.Net.Mail.SmtpReplyReaderFactory .ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory .ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message)"}}发生错误。","exceptionMessage":"无法从传输连接读取数据:net_io_connectionclosed。","exceptionType":"System.IO.IOException","stackTrace":" at System.Net.Mail.SmtpReplyReaderFactory .ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory .ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message)"}}在 System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] 缓冲区,Int32 偏移量,Int32 读取,布尔 readLine) 处的 exceptionType":"System.IO.IOException","stackTrace":"\r\n 在 System.Net。 Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r \n 在 System.Net.Mail.SmtpClient.Send(MailMessage 消息)"}}在 System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] 缓冲区,Int32 偏移量,Int32 读取,布尔 readLine) 处的 exceptionType":"System.IO.IOException","stackTrace":"\r\n 在 System.Net。 Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)\r\n at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r \n 在 System.Net.Mail.SmtpClient.Send(MailMessage 消息)"}}Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message)"}}Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message)"}}

4

0 回答 0