异步/等待与AsyncController? [英] Async/Await & AsyncController?

查看:102
本文介绍了异步/等待与AsyncController?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在控制器中使用Async/Await时是否必须从AsyncController继承,或者如果使用Controller,它是否真的不是异步的? Asp.net Web API怎么样?我认为没有AsyncApiController.目前,我只是从控制器及其工作中继承而来,但它确实是异步的吗?

Do you have to inherit from AsyncController when you're using Async/Await in your controller or will it not truly be asynchronous if you use Controller? How about Asp.net web api? I don't think there is a AsyncApiController. Currently i'm just inheriting from controller and its working but is it truly async?

推荐答案

MVC 4中AsyncController类的XML注释说

The XML comment for the AsyncController class in MVC 4 says

提供与ASP.NET MVC 3的向后兼容性.

Provided for backward compatibility with ASP.NET MVC 3.

该类本身为空.

换句话说,您不需要它.

In other words, you don't need it.

这篇关于异步/等待与AsyncController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆