将业务无关的逻辑,修改为异步执行,示例代码:
public ActionResult SubmitOrder(Order order) { // Save the order to the database synchronously // Send email asynchronously using Task Task.Run(() => SendEmailAsync(order.RecipientEmail, "Order Confirmation", "Your order has been successfully submitted.")); // Notify outbound party asynchronously using Task Task.Run(() => NotifyOutboundPartyAsync("[email protected]", "A new order has been placed.")); // Return appropriate response to the client return View("OrderConfirmation"); }
标签:异步,Task,Run,been,asp,mvc,net,asynchronously,order From: https://www.cnblogs.com/Tpf386/p/17376099.html