默认情况下,ASMX WebService或WCF或aspx页面是异步的吗? [英] Is ASMX WebService or WCF or aspx pages are async by default?

查看:117
本文介绍了默认情况下,ASMX WebService或WCF或aspx页面是异步的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下注自己,这是关于-异步Web服务和我上面提到的其他内容的争执.

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

我在逻辑上认为默认情况下Web服务是同步的,另一个则说这是不正确的. 谁是对是谁?谁能向我解释?

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?

先谢谢了.

推荐答案

默认情况下,所有它们都是同步的,但是您可以异步编写所有代码,也可以异步调用它们.同步/异步调用之间和同步/异步执行之间始终应该有所区别.

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.

通话

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

执行:

  • 同步-服务/页面接收呼叫并进行处理.每个外部处理(文件访问,调用其他服务,调用数据库)都是同步完成的,并且服务/页面会在请求处理的整个过程中阻塞执行线程.
  • 异步-服务/页面接收呼叫,准备外部处理并异步执行它.处理线程返回到线程池,同时可以处理其他请求.一旦外部处理结束,服务/页面执行将再次安排为从线程池接收线程,并完成执行并返回响应.通常仅在具有大量外部通信的高访问量页面/服务上才需要.

这两种类型的异步处理是完全独立的.您可以异步调用同步服务以及任何其他组合.

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

这篇关于默认情况下,ASMX WebService或WCF或aspx页面是异步的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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