扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:Microsoft 2007年11月8日
关键字: Windows
' 错用同步 Web 服务调用所造成的性能极差的 ' 页面! Public Class SyncPage Inherits System.Web.UI.Page Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load '调用 Web 服务 Dim proxy As New localhost.Service1 Label1.Text = proxy.Method1(500) Label2.Text = proxy.Method1(200) End Sub End Class |
Public Class AsyncPage Inherits System.Web.UI.Page Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load '调用 Web 服务 Dim proxy As New localhost.Service1 Dim res As IAsyncResult = proxy.BeginMethod1(500, Nothing, Nothing) Dim res2 As IAsyncResult = proxy.BeginMethod1(200, Nothing, Nothing) Label1.Text = proxy.EndMethod1(res) Label2.Text = proxy.EndMethod1(res2) End Sub End Class |
濡傛灉鎮ㄩ潪甯歌揩鍒囩殑鎯充簡瑙T棰嗗煙鏈€鏂颁骇鍝佷笌鎶€鏈俊鎭紝閭d箞璁㈤槄鑷抽《缃戞妧鏈偖浠跺皢鏄偍鐨勬渶浣抽€斿緞涔嬩竴銆�