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

No comments:

Post a Comment