Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.NET页面中调用SendAysnc_C#_Asp.net_Email - Fatal编程技术网

C# 在ASP.NET页面中调用SendAysnc

C# 在ASP.NET页面中调用SendAysnc,c#,asp.net,email,C#,Asp.net,Email,我想发送一些邮件作为对点击页面的回复。我希望页面不要等待邮件发送,因此SendAsync。在测试过程中,结果表明“,”例如 什么是进行此操作的正确方法?我建议将其发布到某种队列,并在另一个服务的单独线程中处理该队列。请发布您的代码,并解释在哪一行引发的异常。 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CallbackHandler.aspx.cs" Inherits="MyWebRole.CallbackHandle

我想发送一些邮件作为对点击页面的回复。我希望页面不要等待邮件发送,因此SendAsync。在测试过程中,结果表明“,”例如


什么是进行此操作的正确方法?

我建议将其发布到某种队列,并在另一个服务的单独线程中处理该队列。

请发布您的代码,并解释在哪一行引发的异常。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CallbackHandler.aspx.cs" Inherits="MyWebRole.CallbackHandler" Async="true" %>
sc.SendCompleted += ((sender, e) =>
{
    if (e.Error == null)
    {
        newPayment.transmitted = db.GetSQLDate();
        db.SubmitChanges();
    }
    else
    {
        newPayment.exceptions = e.Error.Message + Environment.NewLine + e.Error.StackTrace;
        db.SubmitChanges();
    }
});
sc.SendAsync(mm, null);