473,725 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Call to PageAsyncTask Times Out Every Time

Hi,

I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so the page can carry on rendering whilst the call is taking place and also returning the ASP.NET worker thread to service another page request (for scalability). I have developed a very basic asynchronous object (for testing, that reproduces the same error as my long running query object). Code for the object is as follows:

=============== =============== ============
using System;
using System.Threadin g;

public class TestAsyncClass
{
public TestAsyncClass( ){}

private delegate string InvokeTest();
private InvokeTest deleg;

public string Test()
{
Thread.Sleep(10 00);
return "Hello, World!";
}

public IAsyncResult BeginTest()
{
deleg = new InvokeTest(Test );
return deleg.BeginInvo ke(null, null);
}

public string EndTest( IAsyncResult asyncResult)
{
return deleg.EndInvoke (asyncResult);
}
}
=============== =============== ============
The above class can be called from a very basic ASP.NET page as follows:

=============== =============== ============
TestAsyncClass testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
IAsyncResult iasyncResult = testAsyncClass. BeginTest();
while (!iasyncResult. IsCompleted)
{
Response.Write( "<Br>...Waiting ");
Thread.Sleep(50 0);
}
Response.Write( "<Br>" + testAsyncClass. EndTest(iasyncR esult));
}
=============== =============== ============

As I'd expect, it produces the following:

...Waiting
...Waiting
Hello, World!
However, I don't think the above is really doing what I want, as it ties up the page waiting for it to finish. If I attempt to call the async class using the code below, which I believe will free up the page to do other stuff, then the request always times out (which is my problem).

=============== =============== ============
TestAsyncClass testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(B eginTest, EndTest, TestTimedOut, null, true);
Page.AsyncTimeo ut = new TimeSpan(0, 0, 5);
Page.RegisterAs yncTask(task);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");
return testAsyncClass. BeginTest();
}

public void EndTest(IAsyncR esult result)
{
Response.Write( "<Br>...Success ful: ");
Response.Write( testAsyncClass. EndTest( result));
}

public void TestTimedOut(IA syncResult result)
{
Response.Write( "<Br>...Tim ed Out");
Response.End();
}
=============== =============== ============

Produces the following:

Calling Begin Test
...Timed Out

I don't think I'm passing the IAsyncResult around properly or I'm confusing the two Asynchronous calls. I'm pretty sure that the issue is in my object "TestAsyncClass ()" as my the above web page code using "PageAsyncT ask" is pretty much ripping off any example call to "SqlCommand.Beg inExecuteReader ()" and "SqlCommand.End ExecuteReader() ". Can anyone throw any light on the problem / tell me the error of my ways. Note: the only change I made to the web page, other than "Page_Load( )" is to add Async="true" to the @Page declaration.

Thanks in advance,

- Paul.
Jul 19 '06 #1
4 3220
Paul,
I suspect the issue here is more one of user misinformation than anything
wrong with your code. ASP.NET Web pages don't behave like a Windows Form with
an asynchronous method kicked off. The Page lifecycle is basically halted
until the callback returns. So you should not expect some magical page
rendering and UI visible with your async task happily humming off in the
background somehow.

If you look up Fritz Onion's blog, he has written quite a bit about this and
it should help.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Paul" wrote:
Hi,

I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so the page can carry on rendering whilst the call is taking place and also returning the ASP.NET worker thread to service another page request (for scalability). I have developed a very basic asynchronous object (for testing, that reproduces the same error as my long running query object). Code for the object is as follows:

=============== =============== ============
using System;
using System.Threadin g;

public class TestAsyncClass
{
public TestAsyncClass( ){}

private delegate string InvokeTest();
private InvokeTest deleg;

public string Test()
{
Thread.Sleep(10 00);
return "Hello, World!";
}

public IAsyncResult BeginTest()
{
deleg = new InvokeTest(Test );
return deleg.BeginInvo ke(null, null);
}

public string EndTest( IAsyncResult asyncResult)
{
return deleg.EndInvoke (asyncResult);
}
}
=============== =============== ============
The above class can be called from a very basic ASP.NET page as follows:

=============== =============== ============
TestAsyncClass testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
IAsyncResult iasyncResult = testAsyncClass. BeginTest();
while (!iasyncResult. IsCompleted)
{
Response.Write( "<Br>...Waiting ");
Thread.Sleep(50 0);
}
Response.Write( "<Br>" + testAsyncClass. EndTest(iasyncR esult));
}
=============== =============== ============

As I'd expect, it produces the following:

...Waiting
...Waiting
Hello, World!
However, I don't think the above is really doing what I want, as it ties up the page waiting for it to finish. If I attempt to call the async class using the code below, which I believe will free up the page to do other stuff, then the request always times out (which is my problem).

=============== =============== ============
TestAsyncClass testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(B eginTest, EndTest, TestTimedOut, null, true);
Page.AsyncTimeo ut = new TimeSpan(0, 0, 5);
Page.RegisterAs yncTask(task);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");
return testAsyncClass. BeginTest();
}

public void EndTest(IAsyncR esult result)
{
Response.Write( "<Br>...Success ful: ");
Response.Write( testAsyncClass. EndTest( result));
}

public void TestTimedOut(IA syncResult result)
{
Response.Write( "<Br>...Tim ed Out");
Response.End();
}
=============== =============== ============

Produces the following:

Calling Begin Test
...Timed Out

I don't think I'm passing the IAsyncResult around properly or I'm confusing the two Asynchronous calls. I'm pretty sure that the issue is in my object "TestAsyncClass ()" as my the above web page code using "PageAsyncT ask" is pretty much ripping off any example call to "SqlCommand.Beg inExecuteReader ()" and "SqlCommand.End ExecuteReader() ". Can anyone throw any light on the problem / tell me the error of my ways. Note: the only change I made to the web page, other than "Page_Load( )" is to add Async="true" to the @Page declaration.

Thanks in advance,

- Paul
Jul 19 '06 #2
Thanks for the response Peter, I had found Fritz's blog on these issues when
googling for possible solutions. I've tried both methods documented on his
site, first is using "AddOnPreRender CompleteAsync() " and the second is using
the "RegisterAsyncT ask()" - neither appear to work for me in this instance.
All of the examples use the BeginXXX and EndXXX async. methods of either a
web service or a SQL command object (including Fritz's). In my case I
believe the issue lies in my "TestAsyncClass " object, which is trying to
imitate the functionality that the BeginXXX and EndXXX methods in the async.
web service SQL commands implemenent. As I understand it, from the example
on Fritz's site using "RegisterAsyncT ask()" (see
http://pluralsight.com/blogs/fritz/a...2/14/5861.aspx)

1. ASP Page creates amd registers a Async Task via the RegisterAsyncTa sk(),
these include a BeginXXX, EndXXX and TimeOutXXX events
2. The ASP Page calls all the BeginXXX events registered in 1 above.
3. The BeginXXX event in the web page calls the BeginXXX event in the async
class (a web service in this case)
4. The ASP work thread can now work on finishing the rest of the page,
returning to the pool if the page reaches a point where it is no longer
required before the Async call has returned.
5. The existing ASP work thread (or a new one if existing one was returned
to the pool in step above) starts up to service the EndXXX event when it
fires. This is where my knowledge is a little fuzzy. I guess the "EndXXX"
event fires in the asnyc class, which somehow calls / fires the EndXXX event
in the web page. In my code, only the TimeOutXXX event in the web page
fires, which would appear to indicate that the EndXXX events in my async
class and web page are not linked / working together.

Hopefully that helps to explain my issue a little futher and / or my
misunderstandin g of the process as a whole. Problem is I just can't see how
the examples would work if my understanding of the process, whilst flaky, is
incorrect.

thanks,

- Paul.
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
Paul,
I suspect the issue here is more one of user misinformation than anything
wrong with your code. ASP.NET Web pages don't behave like a Windows Form
with
an asynchronous method kicked off. The Page lifecycle is basically halted
until the callback returns. So you should not expect some magical page
rendering and UI visible with your async task happily humming off in the
background somehow.

If you look up Fritz Onion's blog, he has written quite a bit about this
and
it should help.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Paul" wrote:
>Hi,

I've been struggling with this today, I'm developing a DotNet2.0 website
in C# that needs to call a long running data query. Obviously this is a
good candidate for an Asynchronous call, so the page can carry on
rendering whilst the call is taking place and also returning the ASP.NET
worker thread to service another page request (for scalability). I have
developed a very basic asynchronous object (for testing, that reproduces
the same error as my long running query object). Code for the object is
as follows:

============== =============== =============
using System;
using System.Threadin g;

public class TestAsyncClass
{
public TestAsyncClass( ){}

private delegate string InvokeTest();
private InvokeTest deleg;

public string Test()
{
Thread.Sleep(10 00);
return "Hello, World!";
}

public IAsyncResult BeginTest()
{
deleg = new InvokeTest(Test );
return deleg.BeginInvo ke(null, null);
}

public string EndTest( IAsyncResult asyncResult)
{
return deleg.EndInvoke (asyncResult);
}
}
============== =============== =============
The above class can be called from a very basic ASP.NET page as follows:

============== =============== =============
TestAsyncCla ss testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
IAsyncResult iasyncResult = testAsyncClass. BeginTest();
while (!iasyncResult. IsCompleted)
{
Response.Write( "<Br>...Waiting ");
Thread.Sleep(50 0);
}
Response.Write( "<Br>" + testAsyncClass. EndTest(iasyncR esult));
}
============== =============== =============

As I'd expect, it produces the following:

...Waiting
...Waiting
Hello, World!
However, I don't think the above is really doing what I want, as it ties
up the page waiting for it to finish. If I attempt to call the async
class using the code below, which I believe will free up the page to do
other stuff, then the request always times out (which is my problem).

============== =============== =============
TestAsyncCla ss testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(B eginTest, EndTest,
TestTimedOut , null, true);
Page.AsyncTimeo ut = new TimeSpan(0, 0, 5);
Page.RegisterAs yncTask(task);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback
callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");
return testAsyncClass. BeginTest();
}

public void EndTest(IAsyncR esult result)
{
Response.Write( "<Br>...Success ful: ");
Response.Write( testAsyncClass. EndTest( result));
}

public void TestTimedOut(IA syncResult result)
{
Response.Write( "<Br>...Tim ed Out");
Response.End();
}
============== =============== =============

Produces the following:

Calling Begin Test
...Timed Out

I don't think I'm passing the IAsyncResult around properly or I'm
confusing the two Asynchronous calls. I'm pretty sure that the issue is
in my object "TestAsyncClass ()" as my the above web page code using
"PageAsyncTask " is pretty much ripping off any example call to
"SqlCommand.Be ginExecuteReade r()" and "SqlCommand.End ExecuteReader() ".
Can anyone throw any light on the problem / tell me the error of my ways.
Note: the only change I made to the web page, other than "Page_Load( )" is
to add Async="true" to the @Page declaration.

Thanks in advance,

- Paul

Jul 19 '06 #3
I tracked down the issue late last night, which was in my TestAsyncClass.
The call to the BeginTest() method was missing the two parameters
AsyncCallback and the object for extradata. The first of these fields
joins the callback function in the web page with the call back function in
my asynchronous class.

//public IAsyncResult BeginTest()
public IAsyncResult BeginTest(Async Callback callBack, object extraData)
{
deleg = new InvokeTest(Test );
//return deleg.BeginInvo ke(null, null);
return deleg.BeginInvo ke(callBack, extraData);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback
callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");

// return testAsyncClass. BeginTest();
return testAsyncClass. BeginTest(callB ack, extraData);
}
"Paul" <no****@noone.c omwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Thanks for the response Peter, I had found Fritz's blog on these issues
when googling for possible solutions. I've tried both methods documented
on his site, first is using "AddOnPreRender CompleteAsync() " and the second
is using the "RegisterAsyncT ask()" - neither appear to work for me in this
instance. All of the examples use the BeginXXX and EndXXX async. methods
of either a web service or a SQL command object (including Fritz's). In
my case I believe the issue lies in my "TestAsyncClass " object, which is
trying to imitate the functionality that the BeginXXX and EndXXX methods
in the async. web service SQL commands implemenent. As I understand it,
from the example on Fritz's site using "RegisterAsyncT ask()" (see
http://pluralsight.com/blogs/fritz/a...2/14/5861.aspx)

1. ASP Page creates amd registers a Async Task via the
RegisterAsyncTa sk(), these include a BeginXXX, EndXXX and TimeOutXXX
events
2. The ASP Page calls all the BeginXXX events registered in 1 above.
3. The BeginXXX event in the web page calls the BeginXXX event in the
async class (a web service in this case)
4. The ASP work thread can now work on finishing the rest of the page,
returning to the pool if the page reaches a point where it is no longer
required before the Async call has returned.
5. The existing ASP work thread (or a new one if existing one was returned
to the pool in step above) starts up to service the EndXXX event when it
fires. This is where my knowledge is a little fuzzy. I guess the
"EndXXX" event fires in the asnyc class, which somehow calls / fires the
EndXXX event in the web page. In my code, only the TimeOutXXX event in
the web page fires, which would appear to indicate that the EndXXX events
in my async class and web page are not linked / working together.

Hopefully that helps to explain my issue a little futher and / or my
misunderstandin g of the process as a whole. Problem is I just can't see
how the examples would work if my understanding of the process, whilst
flaky, is incorrect.

thanks,

- Paul.
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
>Paul,
I suspect the issue here is more one of user misinformation than anything
wrong with your code. ASP.NET Web pages don't behave like a Windows Form
with
an asynchronous method kicked off. The Page lifecycle is basically halted
until the callback returns. So you should not expect some magical page
rendering and UI visible with your async task happily humming off in the
background somehow.

If you look up Fritz Onion's blog, he has written quite a bit about this
and
it should help.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Paul" wrote:
>>Hi,

I've been struggling with this today, I'm developing a DotNet2.0 website
in C# that needs to call a long running data query. Obviously this is a
good candidate for an Asynchronous call, so the page can carry on
rendering whilst the call is taking place and also returning the ASP.NET
worker thread to service another page request (for scalability). I have
developed a very basic asynchronous object (for testing, that reproduces
the same error as my long running query object). Code for the object is
as follows:

============= =============== ==============
using System;
using System.Threadin g;

public class TestAsyncClass
{
public TestAsyncClass( ){}

private delegate string InvokeTest();
private InvokeTest deleg;

public string Test()
{
Thread.Sleep(10 00);
return "Hello, World!";
}

public IAsyncResult BeginTest()
{
deleg = new InvokeTest(Test );
return deleg.BeginInvo ke(null, null);
}

public string EndTest( IAsyncResult asyncResult)
{
return deleg.EndInvoke (asyncResult);
}
}
============= =============== ==============
The above class can be called from a very basic ASP.NET page as follows:

============= =============== ==============
TestAsyncClas s testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
IAsyncResult iasyncResult = testAsyncClass. BeginTest();
while (!iasyncResult. IsCompleted)
{
Response.Write( "<Br>...Waiting ");
Thread.Sleep(50 0);
}
Response.Write( "<Br>" + testAsyncClass. EndTest(iasyncR esult));
}
============= =============== ==============

As I'd expect, it produces the following:

...Waiting
...Waiting
Hello, World!
However, I don't think the above is really doing what I want, as it ties
up the page waiting for it to finish. If I attempt to call the async
class using the code below, which I believe will free up the page to do
other stuff, then the request always times out (which is my problem).

============= =============== ==============
TestAsyncClas s testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(B eginTest, EndTest,
TestTimedOu t, null, true);
Page.AsyncTimeo ut = new TimeSpan(0, 0, 5);
Page.RegisterAs yncTask(task);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback
callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");
return testAsyncClass. BeginTest();
}

public void EndTest(IAsyncR esult result)
{
Response.Write( "<Br>...Success ful: ");
Response.Write( testAsyncClass. EndTest( result));
}

public void TestTimedOut(IA syncResult result)
{
Response.Write( "<Br>...Tim ed Out");
Response.End();
}
============= =============== ==============

Produces the following:

Calling Begin Test
...Timed Out

I don't think I'm passing the IAsyncResult around properly or I'm
confusing the two Asynchronous calls. I'm pretty sure that the issue is
in my object "TestAsyncClass ()" as my the above web page code using
"PageAsyncTas k" is pretty much ripping off any example call to
"SqlCommand.B eginExecuteRead er()" and "SqlCommand.End ExecuteReader() ".
Can anyone throw any light on the problem / tell me the error of my
ways. Note: the only change I made to the web page, other than
"Page_Load( )" is to add Async="true" to the @Page declaration.

Thanks in advance,

- Paul


Jul 20 '06 #4
Good follow-up information, Paul.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Paul" wrote:
I tracked down the issue late last night, which was in my TestAsyncClass.
The call to the BeginTest() method was missing the two parameters
AsyncCallback and the object for extradata. The first of these fields
joins the callback function in the web page with the call back function in
my asynchronous class.

//public IAsyncResult BeginTest()
public IAsyncResult BeginTest(Async Callback callBack, object extraData)
{
deleg = new InvokeTest(Test );
//return deleg.BeginInvo ke(null, null);
return deleg.BeginInvo ke(callBack, extraData);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback
callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");

// return testAsyncClass. BeginTest();
return testAsyncClass. BeginTest(callB ack, extraData);
}
"Paul" <no****@noone.c omwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Thanks for the response Peter, I had found Fritz's blog on these issues
when googling for possible solutions. I've tried both methods documented
on his site, first is using "AddOnPreRender CompleteAsync() " and the second
is using the "RegisterAsyncT ask()" - neither appear to work for me in this
instance. All of the examples use the BeginXXX and EndXXX async. methods
of either a web service or a SQL command object (including Fritz's). In
my case I believe the issue lies in my "TestAsyncClass " object, which is
trying to imitate the functionality that the BeginXXX and EndXXX methods
in the async. web service SQL commands implemenent. As I understand it,
from the example on Fritz's site using "RegisterAsyncT ask()" (see
http://pluralsight.com/blogs/fritz/a...2/14/5861.aspx)

1. ASP Page creates amd registers a Async Task via the
RegisterAsyncTa sk(), these include a BeginXXX, EndXXX and TimeOutXXX
events
2. The ASP Page calls all the BeginXXX events registered in 1 above.
3. The BeginXXX event in the web page calls the BeginXXX event in the
async class (a web service in this case)
4. The ASP work thread can now work on finishing the rest of the page,
returning to the pool if the page reaches a point where it is no longer
required before the Async call has returned.
5. The existing ASP work thread (or a new one if existing one was returned
to the pool in step above) starts up to service the EndXXX event when it
fires. This is where my knowledge is a little fuzzy. I guess the
"EndXXX" event fires in the asnyc class, which somehow calls / fires the
EndXXX event in the web page. In my code, only the TimeOutXXX event in
the web page fires, which would appear to indicate that the EndXXX events
in my async class and web page are not linked / working together.

Hopefully that helps to explain my issue a little futher and / or my
misunderstandin g of the process as a whole. Problem is I just can't see
how the examples would work if my understanding of the process, whilst
flaky, is incorrect.

thanks,

- Paul.
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
Paul,
I suspect the issue here is more one of user misinformation than anything
wrong with your code. ASP.NET Web pages don't behave like a Windows Form
with
an asynchronous method kicked off. The Page lifecycle is basically halted
until the callback returns. So you should not expect some magical page
rendering and UI visible with your async task happily humming off in the
background somehow.

If you look up Fritz Onion's blog, he has written quite a bit about this
and
it should help.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Paul" wrote:

Hi,

I've been struggling with this today, I'm developing a DotNet2.0 website
in C# that needs to call a long running data query. Obviously this is a
good candidate for an Asynchronous call, so the page can carry on
rendering whilst the call is taking place and also returning the ASP.NET
worker thread to service another page request (for scalability). I have
developed a very basic asynchronous object (for testing, that reproduces
the same error as my long running query object). Code for the object is
as follows:

============== =============== =============
using System;
using System.Threadin g;

public class TestAsyncClass
{
public TestAsyncClass( ){}

private delegate string InvokeTest();
private InvokeTest deleg;

public string Test()
{
Thread.Sleep(10 00);
return "Hello, World!";
}

public IAsyncResult BeginTest()
{
deleg = new InvokeTest(Test );
return deleg.BeginInvo ke(null, null);
}

public string EndTest( IAsyncResult asyncResult)
{
return deleg.EndInvoke (asyncResult);
}
}
============== =============== =============
The above class can be called from a very basic ASP.NET page as follows:

============== =============== =============
TestAsyncCla ss testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
IAsyncResult iasyncResult = testAsyncClass. BeginTest();
while (!iasyncResult. IsCompleted)
{
Response.Write( "<Br>...Waiting ");
Thread.Sleep(50 0);
}
Response.Write( "<Br>" + testAsyncClass. EndTest(iasyncR esult));
}
============== =============== =============

As I'd expect, it produces the following:

...Waiting
...Waiting
Hello, World!
However, I don't think the above is really doing what I want, as it ties
up the page waiting for it to finish. If I attempt to call the async
class using the code below, which I believe will free up the page to do
other stuff, then the request always times out (which is my problem).

============== =============== =============
TestAsyncCla ss testAsyncClass = new TestAsyncClass( );

protected void Page_Load(objec t sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(B eginTest, EndTest,
TestTimedOut , null, true);
Page.AsyncTimeo ut = new TimeSpan(0, 0, 5);
Page.RegisterAs yncTask(task);
}

public IAsyncResult BeginTest(objec t sender, EventArgs e, AsyncCallback
callBack, object extraData)
{
Response.Write( "<Br><Br>Callin g Begin Test");
return testAsyncClass. BeginTest();
}

public void EndTest(IAsyncR esult result)
{
Response.Write( "<Br>...Success ful: ");
Response.Write( testAsyncClass. EndTest( result));
}

public void TestTimedOut(IA syncResult result)
{
Response.Write( "<Br>...Tim ed Out");
Response.End();
}
============== =============== =============

Produces the following:

Calling Begin Test
...Timed Out

I don't think I'm passing the IAsyncResult around properly or I'm
confusing the two Asynchronous calls. I'm pretty sure that the issue is
in my object "TestAsyncClass ()" as my the above web page code using
"PageAsyncTask " is pretty much ripping off any example call to
"SqlCommand.Be ginExecuteReade r()" and "SqlCommand.End ExecuteReader() ".
Can anyone throw any light on the problem / tell me the error of my
ways. Note: the only change I made to the web page, other than
"Page_Load() " is to add Async="true" to the @Page declaration.

Thanks in advance,

- Paul


Jul 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2300
by: Hubert Baumeister | last post by:
Fifth International Conference on eXtreme Programming and Agile Processes in Software Engineering XP2004 June 6-10, 2004, Garmisch-Partenkirchen, Germany http://www.xp2004.org/
1
281
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private fData as new frmData()
13
4148
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make sense to punch out from managed code to native code (I was using IJW) in order to do some amount of floating point work and, if so, what that certain amount of floating point work was approximately. To attempt to do this I made a program that...
1
2059
by: globus | last post by:
Hi, I've a simple web service running on machine A , and a simple client running con machine B , both on a LAN. I wanted to test the response time. So i've made a simple continuous testing client application , that calls about 10.000 times the web service. Then , I wanted to test what happens when there are more than one
46
3846
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or property bequeathed to another by will. 2. Something handed down from an ancestor or a predecessor or from the past: a legacy of religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF, from ML legatia, from L legare, to depute, bequeath....
4
6052
by: Random | last post by:
Has anyone here implemented RegisterAsyncTask and PageAsyncTask to improve page performance on page databinding? The only samples I've been able to find on this involve using asynchronous operations to run database tasks or web service calls, both of which make implicit use of IAsyncResult. I just want to asyncronously run some databinding code on different parts of my page. Am I going in the wrong direction?
2
1620
by: =?Utf-8?B?S2FseWFu?= | last post by:
Hi, I have to make multiple calls (about 400K) to a webservice which returns a string. And currently it takes about a week to make all the calls. Instead of waiting for the webservice result before i make the next call, I rather want to make the calls and let the results comeback at its own pace. I used Asynchronous calling and callback method, but it does not seems to work. I am sure, asynchronous way will improve my program execution...
12
2305
by: aaragon | last post by:
I have this scenario: several arrays for which I have their fixed values at compilation time. Now, at runtime I need to access a specific array depending on an integer but I want to avoid if and switch statements. My first approach was to rely on partial template specialization. Therefore, I have: // .h file template <int vSomeClass;
6
5927
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with or without parms. I know that any function that is passed to Eval() must be declared Public. It can be a Sub or Function, as long as it's Public. I even have it where the "function" evaluated by Eval can be in a form (class) module or in a standard...
0
8872
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8747
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9392
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9162
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9091
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5997
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3211
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.