【问题标题】:asp.net NetworkInformationException on sending mail - what can be the reason?发送邮件时出现asp.net NetworkInformationException - 可能是什么原因?
【发布时间】:2010-07-09 06:37:22
【问题描述】:
SmtpClient smtp = new SmtpClient(smtpServer);
smtp.Send(msgMail);

有时会在第二行抛出此异常:

System.Net.NetworkInformation.NetworkInformationException:

带有消息:“无法立即完成非阻塞套接字操作”

这是什么意思?可能是什么原因?

一般来说,邮件发送大部分时间都在工作。 这是一台 IIS7 Windows 2008 Server 机器。

谢谢。

编辑:

我在这里找到了一些东西: http://www.thevbzone.com/modWINSOCK.bas

Public Const WSAEWOULDBLOCK = (WSABASEERR + 35)      ' A non-blocking socket operation could not be completed immediately

MSDN 提到了这个错误 (http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx):

资源暂时不可用。

This error is returned from operations on nonblocking sockets that

无法立即完成,...

那么,这实际上意味着什么?我是否应该忽略错误,重新发送邮件...?谢谢。

【问题讨论】:

  • 您能检查一下 ErrorCode 属性并告诉我们它是什么吗?当调用 win32 方法失败时会引发此异常。检查 ErrorCode 可能有助于了解出了什么问题。
  • 您是否在 web.config 的邮件设置部分设置了凭据?

标签: c# asp.net mailing


【解决方案1】:

首先你应该检查 NetworkInformationException 的 ErrorCode 属性,然后在this ms article 中找到这个错误代码。它为您提供有关异常的更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 1970-01-01
    • 2016-05-10
    • 1970-01-01
    • 1970-01-01
    • 2013-02-16
    • 2021-09-01
    相关资源
    最近更新 更多