且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我怎么能放弃在ASP.NET MVC的行动

更新时间:2023-02-17 07:53:23

您可能想看看使用下列类型的控制器的在ASP.NET MVC 使用异步控制器

You may want to look at using the following type of controller Using an Asynchronous Controller in ASP.NET MVC

和也看看这篇文章可以帮助你和取消异步Web服务调用,对不起,我不能给任何code例子这个时候。

and also see if this article helps you out as well Cancel async web service calls, sorry I couldn't give any code examples this time.

我创建了一个例子作为概念证明,说明你可以取消服务器端的请求。 我github上异步取消例如

I've created an example as a proof of concept to show that you can cancel server side requests. My github async cancel example

如果你调用其他网站通过你的code,你有两个选择,这取决于你的目标框架,你想用哪一种方法。我包括在这里引用您的评论:

If you're calling other sites through your code you have two options, depending on your target framework and which method you want to use. I'm including the references here for your review:

WebRequest.BeginGetResponse 在使用.NET 4.0中 HttpClient的用于在.net 4.5本,类有一个方法来取消所有未决的请求。

WebRequest.BeginGetResponse for use in .Net 4.0 HttpClient for use in .Net 4.5, this class has a method to cancel all pending requests.

希望这给你足够的信息来达到自己的目标。

Hope this gives you enough information to reach your goal.