有了Angular js的承诺推迟实现,我们需要WEB API是异步的吗?

时间:2021-07-28 11:08:28

Angular JS supports Promise Defer functionality which is asynchronous. If I have async support on the client side, do I still need to expose async methods via WEB-API?

Angular JS支持异步的Promise Defer功能。如果我在客户端有异步支持,我还需要通过WEB-API公开异步方法吗?

1 个解决方案

#1


2  

Making the client async improves the user experience, because user doesn't have to wait for every request.

使客户端异步可以改善用户体验,因为用户不必等待每个请求。

But using async methods in the server can make the server faster and able to manage more requests. It is the same as in the client, if you don't block the main thread you are able to do other things while the other operation is executing.

但是在服务器中使用异步方法可以使服务器更快,并能够管理更多请求。它与客户端中的相同,如果您不阻止主线程,则在执行其他操作时您可以执行其他操作。

You can implement async methods in one or in both sides. In each side you can get different benefits.

您可以在一个或两个方面实现异步方法。在每一方面,您都可以获得不同的好处。

In this other question there are more information that explais when it is important to use async methods: Why should I create async WebAPI operations instead of sync ones?

在另一个问题中,当使用异步方法很重要时,有更多信息需要解释:为什么我要创建异步WebAPI操作而不是同步操作?

#1


2  

Making the client async improves the user experience, because user doesn't have to wait for every request.

使客户端异步可以改善用户体验,因为用户不必等待每个请求。

But using async methods in the server can make the server faster and able to manage more requests. It is the same as in the client, if you don't block the main thread you are able to do other things while the other operation is executing.

但是在服务器中使用异步方法可以使服务器更快,并能够管理更多请求。它与客户端中的相同,如果您不阻止主线程,则在执行其他操作时您可以执行其他操作。

You can implement async methods in one or in both sides. In each side you can get different benefits.

您可以在一个或两个方面实现异步方法。在每一方面,您都可以获得不同的好处。

In this other question there are more information that explais when it is important to use async methods: Why should I create async WebAPI operations instead of sync ones?

在另一个问题中,当使用异步方法很重要时,有更多信息需要解释:为什么我要创建异步WebAPI操作而不是同步操作?