网站导航免费论文 原创论文 论文搜索 原创论文 网学软件 学术大家 资料中心 会员中心 问题解答 原创论文 大学论文导航 设计下载 最新论文 下载排行 原创论文 论文源代码
返回网学首页
网学联系
最新论文 推荐专题 热门论文 素材专题
当前位置: 网学 > 编程文档 > ASP.net > 正文

详细解读ASP.NET的异步

来源:http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/01/05
这里,我们实现了一个简单的AsyncResult,由于ASP.NET通过回调方法获取异步完成,不会等待异步,所以不需要WaitHandle。在开始请求时,建立一个AsyncResult后直接返回,当异步完成时,调用AsyncResult的SetComplete方法,调用回调方法,再由 ASP.NET调用异步结束。此时整个请求即完成。

当我们访问这个地址,可以得到类似于下面的结果:

App:11240144 Begin:37:24,2676 ThreadId:6 End:37:29,2619 ThreadId:6

可以看到开始和结束在同一个线程中运行。 

498)this.width=498;'' onmousewheel = ''javascript:return big(this)'' alt="" src="/uploadfile/201301/5/8115529551.png" />

当有多个并发请求时,线程池将忙碌起来,开始与结束处理也奖有机会运行于不同的线程上。50个请求并发时的处理数据:

  1. App:52307948    Begin:39:47,8128        ThreadId:6      End:39:52,8231  ThreadId:5  
  2. App:58766839    Begin:39:47,8358        ThreadId:5      End:39:52,8321  ThreadId:7  
  3. App:23825510    Begin:39:47,8348        ThreadId:5      End:39:52,8321  ThreadId:7  
  4. App:30480920    Begin:39:47,8348        ThreadId:5      End:39:52,8321  ThreadId:7  
  5. App:62301924    Begin:39:47,8348        ThreadId:6      End:39:52,8321  ThreadId:6  
  6. App:28062782    Begin:39:47,8338        ThreadId:5      End:39:52,8321  ThreadId:6  
  7. App:41488021    Begin:39:47,8338        ThreadId:6      End:39:52,8321  ThreadId:7  
  8. App:15315213    Begin:39:47,8338        ThreadId:6      End:39:52,8321  ThreadId:6  
  9. App:17228638    Begin:39:47,8328        ThreadId:5      End:39:52,8321  ThreadId:7  
  10. App:51438283    Begin:39:47,8328        ThreadId:6      End:39:52,8321  ThreadId:6  
  11. App:32901400    Begin:39:47,8328        ThreadId:5      End:39:52,8321  ThreadId:7  
  12. App:61925337    Begin:39:47,8358        ThreadId:6      End:39:52,8321  ThreadId:6  
  13. App:24914721    Begin:39:47,8318        ThreadId:6      End:39:52,8321  ThreadId:6  
  14. App:26314214    Begin:39:47,8318        ThreadId:6      End:39:52,8321  ThreadId:6  
  15. App:51004322    Begin:39:47,8358        ThreadId:6      End:39:52,8321  ThreadId:6  
  16. App:51484875    Begin:39:47,8308        ThreadId:5      End:39:52,8321  ThreadId:7  
  17. App:19420176    Begin:39:47,8308        ThreadId:6      End:39:52,8321  ThreadId:6  
  18. App:16868352    Begin:39:47,8298        ThreadId:6      End:39:52,8321  ThreadId:7  
  19. App:61115195    Begin:39:47,8298        ThreadId:5      End:39:52,8321  ThreadId:6  
  20. App:63062333    Begin:39:47,8288        ThreadId:6      End:39:52,8321  ThreadId:6  
  21. App:53447344    Begin:39:47,8298        ThreadId:5      End:39:52,8321  ThreadId:7  
  22. App:31665793    Begin:39:47,8288        ThreadId:5      End:39:52,8321  ThreadId:7  
  23. App:2174563     Begin:39:47,8288        ThreadId:6      End:39:52,8321  ThreadId:6  
  24. App:12053474    Begin:39:47,8318        ThreadId:5      End:39:52,8321  ThreadId:7  
  25. App:41728762    Begin:39:47,8278        ThreadId:6      End:39:52,8321  ThreadId:6  
  26. App:6385742     Begin:39:47,8278        ThreadId:5      End:39:52,8321  ThreadId:7  
  27. App:13009416    Begin:39:47,8268        ThreadId:6      End:39:52,8321  ThreadId:6  
  28. App:43205102    Begin:39:47,8268        ThreadId:5      End:39:52,8321  ThreadId:7  
  29. App:14333193    Begin:39:47,8268        ThreadId:6      End:39:52,8321  ThreadId:6  
  30. App:2808346     Begin:39:47,8258        ThreadId:6      End:39:52,8321  ThreadId:6  
  31. App:37489757    Begin:39:47,8128        ThreadId:5      End:39:52,8231  ThreadId:6  
  32. App:34106743    Begin:39:47,8258        ThreadId:5      End:39:52,8321  ThreadId:7  
  33. App:30180123    Begin:39:47,8248        ThreadId:6      End:39:52,8321  ThreadId:6  
  34. App:44313942    Begin:39:47,8248        ThreadId:5      End:39:52,8321  ThreadId:7  
  35. App:12611187    Begin:39:47,8248        ThreadId:6      End:39:52,8321  ThreadId:6  
  36. App:7141266     Begin:39:47,8238        ThreadId:5      End:39:52,8321  ThreadId:7  
  37. App:25425822    Begin:39:47,8278        ThreadId:5      End:39:52,8321  ThreadId:7  
  38. App:51288387    Begin:39:47,8238        ThreadId:5      End:39:52,8321  ThreadId:7  
  39. App:66166301    Begin:39:47,8228        ThreadId:6      End:39:52,8321  ThreadId:6  
  40. App:34678979    Begin:39:47,8228        ThreadId:6      End:39:52,8321  ThreadId:7  
  41. App:10104599    Begin:39:47,8218        ThreadId:5      End:39:52,8321  ThreadId:6  
  42. App:47362231    Begin:39:47,8258        ThreadId:5      End:39:52,8321  ThreadId:7  
  43. App:40535505    Begin:39:47,8218        ThreadId:6      End:39:52,8321  ThreadId:7  
  44. App:20726372    Begin:39:47,8368        ThreadId:5      End:39:52,8321  ThreadId:5  
  45. App:2730334     Begin:39:47,8368        ThreadId:6      End:39:52,8321  ThreadId:6  
  46. App:59884855    Begin:39:47,8368        ThreadId:5      End:39:52,8321  ThreadId:7  
  47. App:39774547    Begin:39:47,8238        ThreadId:6      End:39:52,8321  ThreadId:6  
  48. App:12070837    Begin:39:47,8378        ThreadId:6      End:39:52,8491  ThreadId:7  
  49. App:64828693    Begin:39:47,8218        ThreadId:5      End:39:52,8331  ThreadId:6  
  50. App:14509978    Begin:39:47,9308        ThreadId:6      End:39:52,9281  ThreadId:5 

  • 上一篇资讯: ASP.NET显示渐变图片
  • 网学推荐

    免费论文

    原创论文

    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号