System.Net.Mail.SmtpException - 但电子邮件仍然发送

时间:2015-02-11 13:05:03

标签: c# asp.net asp.net-web-api windows-server-2012 mvcmailer

我已将我的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 “ ”堆栈跟踪“:”   在System.Net.Mail.SmtpClient.Send(MailMessage消息)\ r \ n at   Mvc.Mailer.SmtpClientWrapper.Send(MailMessage mailMessage)\ r \ n at   Mvc.Mailer.MvcMailMessage.Send(ISmtpClient smtpClient)\ r \ n at   Rpm.ReportBuilder.Web.Controllers.EmailController.GetSendEmail(字符串   template,Int32 id)\ r \ n at   System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor&LT;&GT; c__DisplayClassc.b__6(对象   instance,Object [] methodParameters)\ r \ n at   System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext   controllerContext,IDictionary 2 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.TaskAwaiter 1.GetResult()\ r \ n at   System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext(个)\ r \ n ---   从抛出异常的先前位置开始的堆栈跟踪结束   --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务   任务)\ r \ n at   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务   任务)\ r \ n at   System.Runtime.CompilerServices.TaskAwaiter 1.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 at   System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext(个)\ r \ n ---   从抛出异常的先前位置开始的堆栈跟踪结束   --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务   任务)\ r \ n at   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务   任务)\ r \ n at   System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext(个)\ r \ n ---   从抛出异常的先前位置开始的堆栈跟踪结束   --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务   任务)\ r \ n at   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务   任务)\ r \ n at   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\ r \ n at   System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() “ ”的InnerException“:{ ”消息“:” 一种   错误已经发生。“,”exceptionMessage“:”无法从中读取数据   运输连接:   net_io_connectionclosed “” exceptionType。 “:” System.IO.IOException “ ”堆栈跟踪“:”   在System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte []缓冲区,   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   来电者)\ r \ n at   System.Net.Mail.SmtpConnection.GetConnection(的ServicePoint   ServicePoint)\ r \ n在System.Net.Mail.SmtpClient.Send(MailMessage   消息)“}}

0 个答案:

没有答案