【发布时间】:2015-02-18 17:00:50
【问题描述】:
我在 angularjs 中有一个 HTTP 发布调用,大约需要 7-8 秒才能完成任务。 url 是 MVC 中一个控制器的操作方法。由于这需要很多时间,我不希望我的用户等待此操作,但可以导航到任何其他页面,甚至可以在同一页面上继续执行不同的操作。操作完成后,它将通知用户成功或失败。当前任何其他 http 帖子都会等待该帖子完成,然后再显示其各自的结果。我需要帮助来解决这种情况。最好的方法是什么?我检查了下面的链接,我看到了一些建议。会有帮助吗?链接-http://tech.pro/tutorial/1252/asynchronous-controllers-in-asp-net-mvc
AngularJS 代码-
$http({
url: key_Url_Generate,
method: Post,
params: $scope.PlanDetails
}).then(function (result) {
//Notify user for success or failure
}
控制器动作方法-
[HttpPost]
public ActionResult GenerateLtdQuote(LTD_PlanDetailsVM ltdPlanDetailsVM)
{
// time consuming operation here
}
【问题讨论】:
标签: c# angularjs asynchronous asp.net-mvc-5