问题如下 

System.Net.Mail.SmtpException: Failure sending mail. 
---> System.InvalidOperationException: Asynchronous operations are not allowed
in this context. Page starting an asynchronous operation has to
have the Async attribute set to true and an asynchronous op

 甭理他什么页面需要异步,直接把发邮件代码仍到 Task.Run() 里面执行妥妥的完事儿 :

 

Task.Run(()=> {

SendMailCodes();

});

  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-10-20
  • 2021-07-04
  • 2021-11-02
  • 2021-12-03
猜你喜欢
  • 2022-02-23
  • 2021-07-20
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2021-08-31
相关资源
相似解决方案