默认情况下,ASMX WebService 或 WCF 或 aspx 页面是异步的吗?

发布于 2024-11-13 06:53:13 字数 116 浏览 4 评论 0原文

我把自己卷入了一场赌注,我们的不和是关于异步 Web 服务和我上面提到的其他东西。

我在逻辑上认为Web服务默认是同步的,其他人说这是不正确的。 谁对谁错谁能给我解释一下吗?

提前致谢。

I involved my self within a bet, our feud is about - Async WebServices and the other stuff i mentioned above.

I am thinking logically web service by default is sync, the other said that it is not correct.
Who is right or wrong can any one explain it to me?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

用心笑 2024-11-20 06:53:13

默认情况下,它们都是同步的,但您可以异步编写它们,也可以异步调用它们。您应该始终区分同步/异步调用和同步/异步执行。

同步调用

  • - 客户端调用服务/页面并挂起,直到服务/页面返回响应。
  • 异步 - 客户端调用服务/页面并可以继续工作。客户端通常会通过某些事件(或者可以轮询结果)通知响应已到达。在 ASPX 中,这是典型的回调或 AJAX 调用。

执行:

  • 同步 - 服务/页面接收调用并处理它。每个外部处理(文件访问、调用其他服务、调用数据库)都是同步完成的,并且服务/页面在请求处理的整个持续时间内阻塞执行线程。
  • 异步 - 服务/页面接收调用,准备外部处理并异步执行。处理线程返回到线程池,同时可以处理其他请求。一旦外部处理结束,服务/页面执行就会再次调度以从线程池接收线程,并完成执行并返回响应。这通常仅在具有密集外部通信的高流量页面/服务上需要。

这两类异步处理是完全独立的。您可以对同步服务和任何其他组合进行异步调用。

All of them are by default synchronous but you can write all of them asynchronously and you can call all of them asynchronously. You should always differ between synchronous/asynchronous call and between synchronous/asynchronous execution.

Calls

  • Synchronous - client calls the service/page and hangs on until the service/page returns the response.
  • Asynchronous - client calls the service/page and can continue in work. Client is usually notified by some event (or it can poll the result) that response has arrived. In ASPX this is typical callback or AJAX call.

Execution:

  • Synchronous - service/page receives the call and process it. Every external processing (file access, calling other services, calling database) is done synchronously and the service/page block the executing thread for the whole duration of the request processing.
  • Asynchronous - service/page receives the call, prepares external processing and executes it asynchronously. Processing thread is returned back to thread pool and can server other requests in the meanwhile. Once external processing ends service/page execution is again scheduled to receive a thread from thread pool and it finishes execution and returns response. This is usually only need on high traffic pages/services with intensive external communication.

These two types of asynchronous processing are completely independent. You can have asynchronous calls to synchronous services and any other combination.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文