Asp.net mvc MVC使用取消令牌取消任务
我想使用如下所述的取消令牌取消任务: 唯一的区别是: 我希望在浏览到特定控制器/操作时启动任务,并在离开时取消要调用的任务(tokenSource.cancel()),然后从当前所在的特定操作(页面)中浏览。我该怎么做?谢谢我想明白了 我编写了一个自定义属性过滤器来实现这一点。在代码中,我有以下内容:Asp.net mvc MVC使用取消令牌取消任务,asp.net-mvc,asp.net-mvc-3,c#-4.0,cancellation-token,Asp.net Mvc,Asp.net Mvc 3,C# 4.0,Cancellation Token,我想使用如下所述的取消令牌取消任务: 唯一的区别是: 我希望在浏览到特定控制器/操作时启动任务,并在离开时取消要调用的任务(tokenSource.cancel()),然后从当前所在的特定操作(页面)中浏览。我该怎么做?谢谢我想明白了 我编写了一个自定义属性过滤器来实现这一点。在代码中,我有以下内容: tokenSource = new CancellationTokenSource(); CancellationToken ct = tokenSource.Token; var taskRe
tokenSource = new CancellationTokenSource();
CancellationToken ct = tokenSource.Token;
var taskRepository = UnityContainerSetup.Container.Resolve<ITaskRepository>();
taskRepository.GetTasksStatusAsync(siteId, tasksItem, ct); // ct is my cancellation token that I set to true => to cancel
tokenSource=new CancellationTokenSource();
CancellationToken ct=tokenSource.Token;
var taskRepository=UnityContainerSetup.Container.Resolve();
taskRepository.GetTasksStatusAsync(siteId,tasksItem,ct);//ct是我的取消令牌,我将其设置为true=>以取消
我也很想知道