Showing posts with label timeout. Show all posts
Showing posts with label timeout. Show all posts

Wednesday, March 28, 2012

PageMethod Timeout

Hi

I call a web method exposed in an aspx page as follows:

PageMethods.MyWS("hello world",
OnCallbackComplete,
OnCallbackTimeout,
OnCallbackError,
null,
10); // timeoutInterval

To simulate the timeout I add some sleep time to the thread in the web method, lets say 10000 (10 seconds). Problem is the timeout callback method on the client doesn't get invoked.

Any ideas?

CraigThere was a bug where we weren't respecting the timeoutInterval set onthe request if the default timeout interval is set. Can you checkif you have set the WebRequestManager's timeout interval? Trysetting the WebRequestManager's timeout interval and see if thattriggers the timeout callback...

Hope that helps,
-Hao

Thanks for the reply.

I tried the following which didn't trigger the timeout as expected:

Sys.Net._WebRequestManager._timeoutInterval = 10;

Sys.Net._WebRequestManager.timeoutInterval = 10;

Sys.Net._WebRequestManager.set_timeoutInterval(10); // threw an exception

PageMethods.MyWS("hello world",
OnCallbackComplete,
OnCallbackTimeout,
OnCallbackError);
So that's not quite right, the instance you want to use is the static Sys.Net.WebRequestManager, rather than the _ one.

So you can do Sys.Net.WebRequestManager.set_timeoutInterval(10), or in the xml markup, you can do something like

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<webRequestManager timeoutInterval="3000"/>
</components>
</page>
</script
Hope that helps,
-Hao

that did the trickBig Smile [:D]

thanks

Monday, March 26, 2012

Pagemethods timeout

Is there a built in way to timeout a pagemethod request?
I have tried this

PageMethods.Timeout(key, OnSucceeded, OnFailed,OnTimeOut);

But the OnTimeOut Method never gets called.


The Current version does not have explicit OnTime Callback like the previous versioin instead it is handled in the OnError Callback. Like the Following:

SimpleService.SimpleMethod(function(result) // Success Handler
{
},
function(exceptioin) // Error Handler
{
if (exception.get_timeout())
{
// Timeout
}
else
{
//All other error.
}
}
);


Thank you for your reply.

I have tried this and I still do not get any call to the Error function.

Is there a place where I can look at the documentation for this. I have been searching for it but can't find anything.


Does your Succes Handler Executes, Did you enabled the ScriptManager EnablePageMethods?


Yes, the success handler does execute. Is there a way to set the timeout time? Maybe it is just too long.

Even it takes long time the OnError Callback should be executed. Anyway you can increase the timeout by setting like the following:

PageMethods.set_timout(120);

I have seen the light :) Thanks so much for your help.
It would be nice if this was documented somewhere.

Thanks again.


Would you mind posting the codes, so that i can investigate.