title: An asynchronous operation cannot be started at this time
body: <p>I am making a call to asynchronous operation with the following line of code:</p>
  
  <pre><code>Task.Run(() =&gt; { _emailService.SendEmail(email); }).Wait();
  
  
  public async Task&lt;bool&gt; SendEmail(EmailTemplate email)
  {
      try
      {
          using (Client)
          {
              await Client.SendMailAsync(email.Message);
              return true;
          }
      }
      catch (Exception ex)
      {
          Logger.Fatal(ex.ToString(), "Error occurred while sending an Email.");
          return false;
      }
  }
  </code></pre>
  
  <p>When the code ran the first time, it worked without issues and I received my email, however when I run it every other time since I get the following 2 errors:</p>
  
  <blockquote>
    <p>2016-02-04 15:50:05.3039 [11] FATAL ExceptionHandling.Models.EmailService+d__0.MoveNext - System.ObjectDisposedException: Cannot access a disposed object.
    Object name: 'System.Net.Mail.SmtpClient'.
       at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken)
       at System.Net.Mail.SmtpClient.SendMailAsync(MailMessage message)
       at ExceptionHandling.Models.EmailService.d__0.MoveNext()</p>
    
    <p>2016-02-04 16:33:09.9768 [9] FATAL ExceptionHandling.Models.EmailService+d__0.MoveNext - System.Net.Mail.SmtpException: Failure sending mail. ---> System.InvalidOperationException: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked &lt;%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.</p>
  </blockquote>
  
  <p>I'm trying to understand why do I get the above errors after the first attempt?</p>