1

I am examining async web pages async="True". In Page_Load, I am registering 3 tasks using RegisterAsyncTask. Each of these tasks is calling a SQL Server stored procedure. The stored procedure is doing a simple select and waiting for a couple of seconds using WAITFOR DELAY '00:00:02'
My problem is that the pages takes 6 seconds to get back to me instead of just 2 seconds.

This is the trace of the page.

aspx.page   Begin Load           0.000173230943152662    0.000013 
Inside      BeginAsyncOperation1 0.000268187163843751    0.000095 
Inside      BeginAsyncOperation2 0.000517126445114984    0.000249 
Inside      BeginAsyncOperation3 0.000642237681836351    0.000125 
aspx.page   End Load             6.09175786420362        6.09111 
Any ideas/suggestions?
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
sh_kamalh
  • 3,853
  • 4
  • 38
  • 50
  • I've encountered this problem just now. Pro Asp.net 4 says the tasks run in parallel, but by reading source code of the page class, I found that the tasks are actually handled sequentially. – zhy2002 Jun 29 '11 at 10:41

1 Answers1

1

It turned out that you can use the "executeInParallel" parameter of the PageAsyncTask constructor to control this behaviour.

zhy2002
  • 389
  • 5
  • 11
  • I am already using the last parameter as true `PageAsyncTask task1 = new PageAsyncTask(new BeginEventHandler(BeginAsyncOperation1), new EndEventHandler(EndAsyncOperation1), new EndEventHandler(TimeoutAsyncOperation1), null, true);` but they run sequentially. – sh_kamalh Aug 05 '11 at 13:08